I am posting here instead of a first round at autodesk because I found this routine here. I need to change it slightly but I've failed at doing it.
I have been asked to delete all frozen layers and the entities on them. Including the entities in nested blocks. Here is what I am trying to use.
(defun c:lcu (/ ActDoc LayList LayNameList)
; Erases all objects on frozen layers, then purges drawing.
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(vlax-for Lay (vla-get-Layers ActDoc)
(if
(or
(= (vla-get-Freeze Lay) ':vlax-true)
)
(progn
(vla-put-Lock Lay :vlax-false)
(setq LayList (cons Lay LayList)
LayNameList (cons (vla-get-Name Lay) LayNameList)
)
)
)
)
(vla-StartUndoMark ActDoc)
(if LayList
(progn
(vlax-for Layout (vla-get-Layouts ActDoc)
(vlax-for Obj (vla-get-Block Layout)
(if (member (vla-get-Layer Obj) LayNameList)
(vla-Delete Obj)
)
)
)
(vla-PurgeAll ActDoc)
)
)
(vla-EndUndoMark ActDoc)
(princ)
)
Nested blocks seem to be my problem. I've gotten it to work with blocks but never with nested blocks.
as a side note I have also tried to add versions of
(command (c:-laydel) "n" lay "y") to the routine. That seems to clean the blocks pretty well but I can't seem to incorporate into the lisp well.
Thank you in advance.