TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: blahdc on January 25, 2011, 11:24:10 AM
-
Sorry for the multiple posts lately. Working on some weird projects. Are there any shortcuts to delete all frozen and hidden layers on a DWG? Right now I have to turn off all my current active layers and turn on all my frozen and hidden layers, select them and delete. It would be fine if there were only 5-10 layers but I'm working with 50+ layers per drawing. Ideas? Thanks!
-
This what I use.
(defun c:EFrozeOff (/ ActDoc LayList LayNameList)
; Erases all objects on frozen/off layers, then purges drawing.
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(vlax-for Lay (vla-get-Layers ActDoc)
(if
(or
(= (vla-get-LayerOn Lay) ':vlax-false)
(= (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)
)
-
Why don't you use the command LAYDEL? Core command now but once was a express tool. If you know the layer name to freeze you enough to delete it.
LAYDEL
Deletes all objects on a layer and purges the layer.
-
Because they are never the same name and can be many hidden and frozen layers.
I'm going to give that LISP a try, looks great!
Update: Using the EFrozeoff lsp works great! Many thanks!