Monday, March 14, 2005

Delete AutoCAD layer filters

Often requested tool. Here it is again. I just confirmed that it works great in AutoCAD 2009 as well.

Download DLF.LSP

;;; DLF.LSP
;;;
;;; Delete all layer filters with the DLF command
;;;
;;; By Jimmy Bergmark
;;; Copyright (C) 2004-2008 JTB World, All Rights Reserved
;;; Website: www.jtbworld.com
;;; E-mail: info@jtbworld.com
;;; 2004-05-23 - Added support to delete filters introduced in 2005
;;; 2005-03-14 - Confirmed to work with AutoCAD 2006
;;; 2005-04-19 - Added (vl-load-com)
;;; Written for AutoCAD 2000, 2000i, 2002, 2004, 2005, 2006, 2007, 2008, 2009
;;;

(vl-load-com)

;;; Purge/delete all layer filter or filters
;;; Example: (DeleteLayerFilters)
(defun DeleteLayerFilters ()
(vl-Catch-All-Apply
'(lambda ()
(vla-Remove
(vla-GetExtensionDictionary
(vla-Get-Layers
(vla-Get-ActiveDocument
(vlax-Get-Acad-Object))))
"ACAD_LAYERFILTERS")))
)
;;; Purge/delete all layer filter or filters compatible with 2005 or later
;;; Example: (DeleteLayerFilters2)
(defun DeleteLayerFilters2 ()
(vl-Catch-All-Apply
'(lambda ()
(vla-Remove
(vla-GetExtensionDictionary
(vla-Get-Layers
(vla-Get-ActiveDocument
(vlax-Get-Acad-Object))))
"AcLyDictionary")))
)

(defun c:dlf()
(DeleteLayerFilters)
(DeleteLayerFilters2)
(princ "\nAll layer filters deleted!")
(princ)
)

To batch purge multiple drawings automatically take a look at SmartPurger.

4 comments:

  1. Restored comments

    AJV said...

    Thank you !!!!!!!
    December 14, 2005
    Russbug said...

    FANTASTIC mate!!

    This has saved me so much time!
    Our clients drawings used to take nearly 4 minutes to display the layer command - and I used to forget why I wanted the Layers displayed after the wait ....

    Thank you VERY much!
    February 15, 2006
    3dots said...

    This is the only one that works among all those lisp files on internet. Thank you so much.
    March 10, 2006
    Oseas / PDBGI said...

    (defun merit()
    (princ "Excelent")
    (princ "THANK YOU JIMMY")
    (princ)
    )
    July 20, 2006
    Anonymous said...

    Hey... This sounds great to me but I am not sure how to load the application. Can you tell me step by step please? Thank you.

    Appreciate it..!!
    August 08, 2006
    silvia said...

    Hey.. it sounds great. I really need this cause the layers are getting to me..!!!
    But I am not sure how to load it. Can you please show me step by step??

    THank you.. Appreciate it..!!
    August 08, 2006
    JTB World said...

    To load the application use the command APPLOAD then you can add the DLF.LSP file to the startup suite. Or you can drag and drop the DLF.LSP file into AutoCAD. Then you can use the DLF command.
    August 08, 2006
    silvia said...

    hey.. thanks for replying so quickly. I am using CAD LT2002. And when I load the applicatoin and typed dlf、nothing happened.

    Thanks for being patient//!
    August 08, 2006
    JTB World said...

    Sorry, but AutoCAD LT does not support AutoLISP.
    August 08, 2006
    silvia said...

    DAMN..!!

    I thought I found a magic potion..!! hmm do u know any other suggestion??
    August 08, 2006
    JTB World said...

    Unfortunately none other than upgrade to a later version of LT or full AutoCAD. I think some later versions of LT supports to delete layer filters when you open a drawing. If you manually want to delete layer filters on a drawing you can maybe do that from the layer dialog box. It might be possible to select all using CTRL or SHIFT.
    August 08, 2006
    silvia said...

    I can delete them but it takes time because its populated with them and I have to delete them 1 by 1 that is the problem.

    Well let me know if you know an easier way.
    Thanks
    August 09, 2006
    Anonymous said...

    OMG.

    Just loaded the lisp file and a second later they are gone. copied the lisp to the support directory, used appload to load it and then typed dlf. filters gone.

    Thanks from all of us.
    October 02, 2006
    Anonymous said...

    Thank you, you saved me a lot of time and my sanity
    November 01, 2006
    James Maeding said...

    for real speed, try the purgeids prog from cadthinking.com, it does app id's and layer filters both. It is literally 100 times faster than scripting through drawings and is the only practical way to purge registered app id's.
    November 10, 2006
    Anonymous said...

    Thank you soooooo much. Now I can make my dead line. It was so quick and simple that I wish I asked for help 2 days ago.

    Thank you Jimmy a million times over.
    August 08, 2007
    froggy said...

    Thanks a lot!
    It works on AutoCAD 2008!
    April 25, 2008
    Peter DeRooy said...

    It does not seam to work in AutoCAD 2004. Any Ideas Jimmy?
    May 05, 2008
    Peter DeRooy said...

    Never Mind. It works great. Just had to save and reopen the file.
    thanks
    May 05, 2008
    JTB World said...

    Peter, good to hear you found out how to do it.
    May 05, 2008

    ReplyDelete
  2. Mentioned in Cadalyst Magazine Tips & Tools Weekly.
    http://management.cadalyst.com/

    ReplyDelete
  3. Thanks! Lifesaver!

    ReplyDelete
  4. Thanks Guys.
    Just what I needed.
    Works fine in 2000
    Baz

    ReplyDelete

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner