Annoying layer filters

AutoCAD seems to be inserting thousands of layer filters into my drawings

> without my asking it to. So many that it takes 20 or 30 minutes to delete > them all while jamming down the Enter key. They are junk filter names, many > words misspelled 4 or 5 different ways. By the type of names, they could be > from engineering or architectural or who knows what sources. I have no idea > where they come from. I can delete them all and they will come back a few > days later. > > I don't know of a way to delete filters except one at a time. > > Can I delete them all at once? > > Do you know how I can stop them entering my drawings? > > Thanks, > David Sheppard
Reply to
Allan Johanson
Loading thread data ...

Layer Filters are stored in the drawing. Any time you copy an object from a drawing with these filters to another drawing, the object will bring those filters along for the ride. Ditto if you insert a drawing with filters into a new drawing.

To remove ALL layer filters you can use this lisp routine by R. Robert Bell:

;;;;;;;;;BEGIN CODE (defun C:LayerFiltersDelete () (vl-Load-Com) (vl-Catch-All-Apply '(lambda () (vla-Remove (vla-GetExtensionDictionary (vla-Get-Layers (vla-Get-ActiveDocument (vlax-Get-Acad-Object)))) "ACAD_LAYERFILTERS"))) (princ "\nAll layer filters have been deleted.") (princ))

(defun C:LFD () (C:LayerFiltersDelete)) ;;;;;;;;;;;END CODE

usage: type "LFD" at the command prompt

OR, if you have your own filters you'd like to keep.....create them with a unique prefix that you can then use in this lisp:

;;;;;;BEGIN CODE ;;Original code to delete all layer filters by R. Robert Bell. ;;Heavily modified to delete only specific filters by ;;Jeff Mishler, December 2003

(defun c:filtrdel (/ names dicts) (vl-Load-Com) (princ "\nRoutine to delete all but the specified Layer filters. When entering filter names to retain, wildcards are allowed. i.e., entering \"zz*,xx*\" will delete all filters except those beginning with zz and xx.") (setq names (getstring "\nEnter filter names to retain, press Enter for none: ")) (vl-Catch-All-Apply '(lambda () (setq dicts (vla-GetExtensionDictionary (vla-Get-Layers (vla-Get-ActiveDocument (vlax-Get-Acad-Object) ) ) ) ) (vlax-for dict dicts (if (and (= (vla-get-name dict) "ACAD_LAYERFILTERS") (> (vla-get-count dict) 0)) (progn (vlax-for filtr dict (if (not (wcmatch (vla-get-name filtr) names)) (vla-delete filtr) ) ) ) ) ) ) ) (princ "\nSpecified layer filters have been deleted.") (princ) ) ;;;;;;;;;END CODE

usage: type "filtrdel" at the command prompt

To keep them from coming back, delete them from all drawings and then make sure to check drawings from outside sources prior to using them in your drawings.

HTH, Jeff

Reply to
Jeff Mishler

Got anything that'll work in r14, Jeff?

Reply to
Michael Bulatovich

Michael,

You can e-mail me direct, and I'll send you a lisp routine that doesn't use vla vlax.

Bret

Reply to
Bret Tresidder

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.