@ariskouros wrote:
Hi. I'm searching a lisp to change layers colour without selection.
I have layer 1 to colour red,layer 2 to yellow,layer 3 to green....
Maybe something like this. You should edit layercolors list values with proper layer colors.
("layername" . "layercolor") , this works only for indexed colors.
Add function to startup suite and use it after you load your dwgs.
(defun c:layerColor ( / adoc layercolors name col)
(setq layercolors
'(
("0" . 15)
("1" . 25)
("2" . 35)
("3" . 45)
("4" . 55)
)
)
(setq adoc (vla-get-ActiveDocument (vlax-get-acad-object)))
(vlax-for lay (vla-get-Layers adoc)
(setq name (vlax-get lay "Name"))
(setq col (cdr(assoc name layercolors)))
(vla-put-Color lay col)
(vlax-release-object lay)
)
(vlax-release-object adoc)
(princ)
)
Miljenko Hatlak

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.