setbylayer

setbylayer

Anonymous
Not applicable
6,008 Views
21 Replies
Message 1 of 22

setbylayer

Anonymous
Not applicable

Hey guys,

 

I am in an AutoCAD class with a teacher who could careless that I am using AutoCAD '11 for mac and doesn't know why the 'setbylayer' command doesn't work.  I looked at the list of commands that don't work with the mac version and I don't see this specific command on the list.

 

Anyone have any ideas on the subject?

 

 

Greg Bolton

Loyalist College - BRET

 

0 Likes
Accepted solutions (2)
6,009 Views
21 Replies
Replies (21)
Message 2 of 22

Anonymous
Not applicable

I would imagine that your instructors lack of enthusiasm to fix your issue is due to the fact that you are not using the same software as the rest of the class.  It would be like taking a Microsoft Word class and then getting mad when someone won't help you with Wordpad.  Apples and oranges, if you will.

 

0 Likes
Message 3 of 22

maxim_k
Consultant
Consultant
Accepted solution

Hi Greg,

 

I never use SETBYLAYR command. But you can do the same (as SETBYLAYER do) with Properties Inspector: just select objects you want to change and in Properties Inspector select from drop-down lists "ByLayer":

 

Screen shot 2011-02-16 at 20.38.28.png

 

Maxim


Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
0 Likes
Message 4 of 22

maxim_k
Consultant
Consultant
Accepted solution

Hi Greg,

 

You can use also simple LISP routine to add SETBYLAYER command to AutoCAD for Mac, if you don't need to change default settings for this command (that is, everything change to Bylayer):

 

 

(defun c:SETBYLAYER ( / ss1 old_cmd )
(setq old_cmd (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(setq ss1 (ssget))
(if (= 1 (getvar "PSTYLEMODE"))
(progn
(princ "\nChanged settings: Color Linetype Lineweight Transparency Material")
(command "_chprop" ss1 "" "_C" "ByLayer" "_LT" "ByLayer" "_LW" "ByLayer" "_TR" "ByLayer" "_M" "ByLayer" "")
)
(progn
(princ "\nChanged settings: Color Linetype Lineweight Transparency Material Plotstyle")
(command "_chprop" ss1 "" "_C" "ByLayer" "_LT" "ByLayer" "_LW" "ByLayer" "_TR" "ByLayer" "_M" "ByLayer" "_PL" "ByLayer" "")
)
)
(setvar "CMDECHO" old_cmd)
(princ)
)

 

 

Just appload Setbylayer.lsp ad you can use SETBYLAYER command.

 

You can say to your teacher  that there is almost everything is possible in AutoCAD Smiley Wink


Maxim

 


Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
Message 5 of 22

UNKNOWN.DESIGN.LAB
Advocate
Advocate

Hello @maxim_k ,

 

Can i get a variation of this LISP that will allow me to also change the layers use in a block's definition ?

I am trying to find a work around to not being able to delete layers on my file due to them being used in block definitions.

 

I am sure this such a common case and that there is a solution for it. I am working with multiple people on a project and my layer system structure keeps getting VERY hectic due to layers from blocks others are using.

 

Regards

0 Likes
Message 6 of 22

maxim_k
Consultant
Consultant

Hi @UNKNOWN.DESIGN.LAB ,

 

I saw your initial post in Customization Forum and I responded here:

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8657860#M3...

 

I hope someone will help you there.

If not, come back here, we will try to find another way.

 


Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
0 Likes
Message 7 of 22

pendean
Community Legend
Community Legend
LAYMRG layers you do not want but cannot delete, there is no need to spend any time doing anything else https://knowledge.autodesk.com/support/autocad-for-mac/learn-explore/caas/CloudHelp/cloudhelp/2018/E...

0 Likes
Message 8 of 22

ronjonp
Mentor
Mentor

Since you need vanilla lisp on Mac to do this, use Lee's 'blockcomponents' from HERE and call like so:

(defun c:foo (/ blockcomponents a b)
  (while (setq a (tblnext "block" (null a)))
    (or	(wcmatch (setq b (cdr (assoc 2 a))) "*|*")
	(foreach x (blockcomponents b) (entmod (append (entget x) '((62 . 256)))))
    )
  )
  (princ)
)
0 Likes
Message 9 of 22

UNKNOWN.DESIGN.LAB
Advocate
Advocate

Hello @ronjonp thank you for your addition. I created the LISP and used the Appload command to load it onto the model file but i was not prompted anything. Is that the way it should be ?

0 Likes
Message 10 of 22

ronjonp
Mentor
Mentor

@UNKNOWN.DESIGN.LAB wrote:

Hello @ronjonp thank you for your addition. I created the LISP and used the Appload command to load it onto the model file but i was not prompted anything. Is that the way it should be ?


Did you add the 'blockcomponents' function from CADTutor? When you run 'foo' it will not prompt to do anything, just process all blocks in the drawing.

0 Likes
Message 11 of 22

miba4p
Contributor
Contributor

Guten Tag zusammen

aktuell habe ich Autocad Mac 2024.1 (U.100.M.315) installiert.

Um eine Zeichnung (inkl. Blöcke) in einer anderen Zeichnung zu referenzieren, sollte diese Referenz mit der Farbe 253 angezeigt werden.

Ich finde den Befehl "setbyLayer" in der Version 2024 nicht.

Die oben beschriebene Lösung über die Eigenschaften habe ich versucht, allerdings ändert das nicht die Farbe der Blöcke.

Hat jemand eine Idee, wie ich den gesamten Plan als Referenz in grau (253) darstellen kann?

Vielen Dank für die Inputs (Beginner)

 

 

0 Likes
Message 12 of 22

maxim_k
Consultant
Consultant

Hi @miba4p ,

 

Yes, SETBYLAYER is still unavailable in AutoCAD for Mac.

You can try to use AutoLISP routine from >>>THIS<<< post.

If you need to set color "ByLayer" - use routine from >>>THIS<<< post.

Of course, you need to use there routines in attached drawing (Xref), but not in "master" drawing.

After you change color to "ByLayre" in the attache drawing, you can change color of all Xref layers to grey in "master" drawing.

 


Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
0 Likes
Message 13 of 22

miba4p
Contributor
Contributor

Hi @maxim_k 

thanks a lot for your Answer

i‘ll try the different Versions … and hope I’ll find a Tutorial „how to generate a AutoLisp“ 🙂
I‘ve learned the AutoCAD by myself and are still Beginner-Level

Do you know the „XREFOVERRIDE“ and „LAYKONV„ and are they also a Option?

I‘ll study them also to see how i can use them

Best Regards and a happy day to you

Michael

0 Likes
Message 14 of 22

miba4p
Contributor
Contributor

Guten Tag zusammen
da ich die Geschichte mit dem „Auto-LISP“ nicht hinbekommen habe, habe ich mit einem Workaround gearbeitet. Ich versandte die Datei auf einen Windowsrechner und nutzte dort setbylayer. Dieser Computerzugang fällt demnächst weg. Auf dem AutoCAD 2025 for Mac finde ich den Befehl "setbylayer" nicht. Suche ich falsch, oder wurde er nicht implementiert?
... und wenn er nicht implementiert wurde, wie bekomme ich es hin, dass ich eine ganze Zeichnung mit verschachtelten Blöcken mit einem Befehl auf die Farbe 253 einstellen kann?

Wenn ich die Zeichnung auswähle, dann habe ich im Menü „Eigenschaften-Inspektor“ keine Felder, die ich auf „byLayer“ umstellen könnte.
Vielen Dank für die Unterstützung … drehe aktuell etwas am Rad :-S 

 

0 Likes
Message 15 of 22

pendean
Community Legend
Community Legend

Greetings @miba4p 

 

Your only option today is to use LISP (after you download it to your computer): here is an explanation in HELP for how you can setup/use LISP in AutoCAD2025 for MAC to get you started

https://help.autodesk.com/view/ACDMAC/2025/ENU/?guid=GUID-49BC17B0-D6CC-4FD2-980F-184ACC9708E8 

0 Likes
Message 16 of 22

miba4p
Contributor
Contributor

Hi pendean

thanks a lot for helping ... i'll try it again ... and hope the best 

It cost so much additional time to solve this Problems ...

Best Regards and a happy Weekend,

Michael

 

 

0 Likes
Message 17 of 22

stnada002
Observer
Observer

This worked perfectly ! Thank you 

0 Likes
Message 18 of 22

miba4p
Contributor
Contributor

Hi @maxim_k 

I think I'm one step closer to mapping the setbylayer function.
I have installed Visual-Code and created the two functions "foo.lsp" and "setbylayer.lsp"
I can select the two files after the "Appload" command and also load and execute them.
Unfortunately, both *.lsp files do not perform the same functions as setbylayer in Autocad for Windows
Do you see what I am doing wrong?
The goal is that the attached architectural drawing outputs everything in color 253 and I can simply hide the layers I don't need.
I get the file as a modified version each time, which I then have to use as an xref again... the process repeats several times and I can't manually rearrange each element, dimension line and block.
Many thanks for your support
Best regards,
Michael
Best regards,
Michael

0 Likes
Message 19 of 22

maxim_k
Consultant
Consultant

Hi @miba4p ,

 

If you need to change color of all objects, including blocks, to 253, you can try attached LSP.

APPLOAD it and use SET_253 command.

This AutoLISP routine doesn't change the color inside MTEXT objects if some text was formatted with other then "ByLayer" color and doesn't update the color of attributes of inserted blocks.

 


Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
Message 20 of 22

miba4p
Contributor
Contributor

Hello @maxim_k , thank you very much!
I tried the macro and it does exactly what I need (4 files and 4 times success = 100% success)
Thank you very much, that makes my life a lot easier.
What can I return the favor with - as an energy exchange?
Have a particularly good weekend,
best regards,
Michael

0 Likes