I have written a small lisp to turn on the IFC layer and turn off the other stamp layers.
I think my brackets and not quite correct, and I cannot figure out how to turn on the "VP Freeze", and "Print" in the layer manager with the LISP. I want to insert this into the title block updater in AutoCAD Electrical.
Thanks for any guidance/help.
(defun c:IFCOn (/ l n)
(vlax-for l (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
(if (wcmatch (setq n (vla-get-name l)) "ISSUE STAMP IFC")
((vla-put-layeron l :vlax-TRUE)(vla-put-freeze l :vlax-false))
)
(if (wcmatch (setq n (vla-get-name l)) "ISSUE STAMP IFA")
((vla-put-layeron l :vlax-FALSE)(vla-put-freeze l :vlax-TRUE))
)
(if (wcmatch (setq n (vla-get-name l)) "ISSUE STAMP IFB")
((vla-put-layeron l :vlax-FALSE)(vla-put-freeze l :vlax-TRUE))
)
(if (wcmatch (setq n (vla-get-name l)) "ISSUE STAMP FRO")
((vla-put-layeron l :vlax-FALSE)(vla-put-freeze l :vlax-TRUE))
)
(if (wcmatch (setq n (vla-get-name l)) "ISSUE STAMP AB")
((vla-put-layeron l :vlax-FALSE)(vla-put-freeze l :vlax-TRUE))
)
(if (wcmatch (setq n (vla-get-name l)) "ISSUE STAMP IFBP")
((vla-put-layeron l :vlax-FALSE)(vla-put-freeze l :vlax-TRUE))
)
(if (wcmatch (setq n (vla-get-name l)) "ISSUE STAMP IFR")
((vla-put-layeron l :vlax-FALSE)(vla-put-freeze l :vlax-TRUE))
)
(if (wcmatch (setq n (vla-get-name l)) "ISSUE STAMP PP")
((vla-put-layeron l :vlax-FALSE)(vla-put-freeze l :vlax-TRUE))
)
)
(princ)
)
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
This doesn't answer your question directly, but I think would accomplish the same thing, and doesn't require extracting and stepping through the collection of all Layers:
(command "_.layer" "_freeze" "ISSUE STAMP*" "_thaw" "ISSUE STAMP IFC" "_on" "ISSUE STAMP IFC" "")
[By the way, I don't see any purpose served by both turning off and freezing Layers. Freezing alone will handle it. Only if for some reason when you later thaw them you want them still to be off so they don't appear, but then why thaw them?]
Hi,
PLOT, check your help about LAYER object (ActiveX documentation in your case),
the property is Plotable, or Plottable?
Check the help.
https://help.autodesk.com/view/ACD/2021/DEU/?guid=GUID-14F28A52-81E5-4CD0-AA79-ADC09E91BB8C
VP Freeze
This is NOT a Layer property, It's a viewport thing.
Check out other forum thread how to handle it, use the search function.
(I am using google for example)
Untested first hit: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vp-freeze-a-list-of-layers-in-a-view...
Sebastian
A more succinct re-coding that allows for expansion. n has been removed as it was never used
(defun c:IFCOn (/ plst ly vlst)
(setq plst (list 'layeron 'freeze));list of properties
(vlax-for ly (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
(cond ( (wcmatch (vlax-get ly 'name) "ISSUE STAMP*")
(if (wcmatch ly "*IFC")
(setq vlst (list :vlax-true :vlax-false));list of property values
(setq vlst (list :vlax-false :vlax-true))
)
(mapcar '(lambda (x y) (vlax-put-property ly x y)) plst vlst)
)
)
)
(princ)
)
If by print you mean the plottable property this canbe added to the above as it is boolean.
If by vp freeze you mean the viewportdefault property (layer is to be frozen in new viewports) this canalso be added to the above as it is also boolean.
I am not one of the robots you're looking for
Can't find what you're looking for? Ask the community or share your knowledge.