Author Topic: Delete all Frozen and Hidden Layers  (Read 15110 times)

0 Members and 1 Guest are viewing this topic.

blahdc

  • Guest
Delete all Frozen and Hidden Layers
« 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!

T.Willey

  • Needs a day job
  • Posts: 5247
Re: Delete all Frozen and Hidden Layers
« Reply #1 on: January 25, 2011, 11:25:55 AM »
This what I use.

Code: [Select]
(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)
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Krushert

  • Seagull
  • Posts: 13656
  • FREE BEER Tomorrow!!
Re: Delete all Frozen and Hidden Layers
« Reply #2 on: January 25, 2011, 11:34:00 AM »
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.

Quote from: from Autocad's Help
LAYDEL
Deletes all objects on a layer and purges the layer.

I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

blahdc

  • Guest
Re: Delete all Frozen and Hidden Layers
« Reply #3 on: January 25, 2011, 12:41:12 PM »
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!
« Last Edit: February 01, 2011, 01:37:19 PM by blahdc »