[Search tip detail and code files using keywords, tip number, author name, etc ]
Purge Unused Layers
Tip# 3077 By Arnold Williams On 24-Dec-2008
Rated By 1 users
Categories : Tips & Tools Weekly Archive Tips
Software type : AutoCAD
Rename File To : No Files to download.
Purge unsued layers without setting your default layer to zero.

Arnold Williams offered this tip for getting rid of unused layers. "AutoCAD does not let you purge an unused layer if it is current. This little tool gets around that by making Layer 0 current first, then running the Purge command. If the previous current layer is not purged in this process, then it is restored as the current layer again after purging is complete. If that previous current layer is purged, then layer 0 remains current."

(defun c:PUL ( / CLyr)
(vl-cmdf "_.undo" "_begin")
(if (not (eq (getvar "clayer") "0"))
   (setq CLyr (getvar "clayer"))
   (setvar "clayer" "0")
  (vl-cmdf "_.purge")
(if (and CLyr (tblsearch "LAYER" CLyr))
  (setvar "clayer" CLyr)
(vl-cmdf "_.undo" "_end")

Good idea. Nothing is more frustrating with purging than when you realize you're on a nonreferenced layer. This is a nice way to purge and not have to remember to set your default layer to zero.


Average Rating:

User comments