Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Purge Frozen Layers

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
756 Views, 8 Replies

Purge Frozen Layers

Does anyone have a macro that will delete frozen and off layers.
I have a way of doing this but it takes a while.
U have to lock all layers.
Then unlock frozen & turned off layers
Thaw and turn on all layers
Then select all and press delete.
All previously on layers will be left due to being locked.
- can i do all that in a macro. I get stuck on the first selct all.
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: Anonymous

who but make a filter selection (ssget "x" '((8 . "yourlayer")))
then erase this selection and purge the layer

rcr
Message 3 of 9
Anonymous
in reply to: Anonymous

o i forgot you have to go first to the list of layers with tblnext and view whats the status of the layers
Message 4 of 9
Anonymous
in reply to: Anonymous

this can esily done in a lisp - but you need to
guve more information -

do these layers contain objects?

are they possibly linked to viewports?


--
Jamie Duncan

 

"Maybe the Hokey Pokey is REALLY what's it all about"


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Does
anyone have a macro that will delete frozen and off layers.
I have a way
of doing this but it takes a while.
U have to lock all layers.
Then
unlock frozen & turned off layers
Thaw and turn on all layers
Then
select all and press delete.
All previously on layers will be left due to
being locked.
- can i do all that in a macro. I get stuck on the first
selct all.
Message 5 of 9
Anonymous
in reply to: Anonymous

This will delete frozen or off layers that are not current, containing
objects, layer 0, etc.

(defun C:dfol (/ layers)
(vl-load-com)
(setq layers (vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object))))
(vlax-for each layers
(or (= (vla-get-freeze each) :vlax-true)
(= (vla-get-layeron each) :vlax-false)
(vl-catch-all-apply 'vlax-invoke-method (list each 'delete))))
(princ)
)

--
"We can't solve problems by using the same kind
of thinking we used when we created them."
--Albert Einstein

Ken Alexander
Acad 2000
Win 2000
"mikescottedwards" wrote in message
news:f146187.-1@WebX.maYIadrTaRb...
> Does anyone have a macro that will delete frozen and off layers.
> I have a way of doing this but it takes a while.
> U have to lock all layers.
> Then unlock frozen & turned off layers
> Thaw and turn on all layers
> Then select all and press delete.
> All previously on layers will be left due to being locked.
> - can i do all that in a macro. I get stuck on the first selct all.
Message 6 of 9
Anonymous
in reply to: Anonymous

Without considering layers tied to layouts

this will select all layers frozen and/or off,

thaw them and turn them on. erase everything on them

and finally purge them.

 

(defun purgelayer ( / layername layerlist ss)
 (setq
layerlist "")
 (tblnext "layer" t)
 (while (setq layername
(tblnext "layer"))
  (if
   (or
    (<
(cdr (assoc 62 layername)) 0)
    (= (cdr (assoc 70
layername)) 1)
   )
   (setq layerlist (strcat
layerlist (cdr (assoc 2 layername)) ","))
  )
 );end
while
 (command ".layer" "t" layerlist "On" layerlist "")
 (if
(/= layerlist "")
  (progn
   (setq ss (ssget "x" (list
(cons 8 layerlist))))
   (if ss
    (command
".erase" ss "")
   )
   (command ".purge" "layer"
layerlist "n")
  )
 );end if
 (princ)
)


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Does
anyone have a macro that will delete frozen and off layers.
I have a way
of doing this but it takes a while.
U have to lock all layers.
Then
unlock frozen & turned off layers
Thaw and turn on all layers
Then
select all and press delete.
All previously on layers will be left due to
being locked.
- can i do all that in a macro. I get stuck on the first
selct all.
Message 7 of 9
Anonymous
in reply to: Anonymous

Okay, I'm getting somewhere. If i create two filters. One that has only the layer turned on, the other turned off. I can lock the LayersON filter. Unlock, unfreeze the LayersOff filter and select all and delete. That works. Now how to i get a buttom macro to create the two filters and do all that.
Message 8 of 9
Anonymous
in reply to: Anonymous

PURGEOFF.LSP from
http://www.turvill.com/t2/free_stuff
... and as it says, use it with caution ... it falls in the "be careful what
you wish for" category.
___

"mikescottedwards" wrote in message
news:f146187.-1@WebX.maYIadrTaRb...
> Does anyone have a macro that will delete frozen and off layers.
Message 9 of 9
Anonymous
in reply to: Anonymous

In 2013 Autocad

 

Command: LAYDEL
Select object on layer to delete or [Name]: N

 

Displays a list of layers that you can delete. Press Shift or Ctrl to select more than one layer. Layers that cannot be deleted

include the current layer, layer 0, locked layers, and xref-dependent layers.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report