Need to freeze layers in a xref file
Hello,
I need a code that will freeze a group of layers that are xref into the main drawing, not by name but by color 200. There will be a number of xrefs in this drawing so I need it to do this by a wildcard, not by drawing name, and I also need it to skip one drawing which is named 24_CD.dwg.
Thank you.
KC
Re: Need to freeze layers in a xref file
Untested:
Code:
(vl-load-com)
(defun c:FrzXR200 ( / )
(vlax-for layer (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object)))
(if (and (wcmatch (vla-get-Name layer) "*|*") ;Is xref layer
(wcmatch (strcase (vla-get-Name layer)) "~24_CD|*") ;Not the 24_CD xref's layers
(= (vla-get-Color layer) 200)) ;Only layers with colour set to 200
(vla-put-Freeze layer :vlax-true)))
(princ))
Re: Need to freeze layers in a xref file
Thank you, the code works great.
Re: Need to freeze layers in a xref file
Glad to help. Hope you can figure out what's happening in my code - that way you could modify it if you have other options to check for ;)