Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am wondering if there is way to delete all freeze and off layer, many thanks. 🙂
Solved! Go to Solution.
Hello,
I am wondering if there is way to delete all freeze and off layer, many thanks. 🙂
Solved! Go to Solution.
Delete all frozen and off layers? You could use the LAYDEL command (just create a (command) with the proper prompts answered), but typically deleting layers that have objects on them can cause corruption. So you might want to delete all those entities first.
Christopher T. Cowgill, P.E.
AutoCAD Certified Professional
Civil 3D Certified Professional
Civil 3D 2026 on Windows 11
Please select the Accept as Solution button if my post solves your issue or answers your question.
I use this almost daily:
(defun c:frzlaydel (/ d er fl n n2)
;; RJP » 2020-08-05
(mapcar 'set '(er n n2) '(0 0 0))
;; Get frozen and off layers
(vlax-for lay (vla-get-layers (setq d (vla-get-activedocument (vlax-get-acad-object))))
(and (not (wcmatch (strcase (vla-get-name lay)) "*|*,0,DEFPOINTS"))
(or (= -1 (vlax-get lay 'freeze)) (= 0 (vlax-get lay 'layeron)))
(setq fl (cons (vla-get-name lay) fl))
(vlax-put lay 'lock 0)
)
)
(if fl
(progn (vlax-for b1 (vla-get-blocks d)
;; If it's not an xref
(if (= 0 (vlax-get b1 'isxref))
(vlax-for b2 b1
(if (vl-position (vla-get-layer b2) fl)
(if (vl-catch-all-error-p (vl-catch-all-apply 'vla-delete (list b2)))
(setq er (1+ er))
(setq n (1+ n))
)
(setq n2 (1+ n2))
)
)
)
)
(repeat 3 (vla-purgeall d))
(princ (strcat (itoa er)
" errors deleting objects...\n"
(itoa n)
" objects were deleted, "
(itoa n2)
" objects were ignored."
)
)
)
(princ (strcat "\nNo eligible layers found."))
)
(princ)
)
Could be handy. But... a bit too powerful for my taste. I would probably add the option to save objects inside blocks. These objects are difficult to acknowledge.
@pendean Thanks!
It's been very helpful for me. I couple it with code to change certain layer colors and force everything to bylayer then super purge and close. 😎
On average after I 'clean' a base it's reduced in file size over 50%-90%.
It worked for me, thank you