- posted
20 years ago
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
Got anything that'll work in r14, Jeff?
Michael,
You can e-mail me direct, and I'll send you a lisp routine that doesn't use vla vlax.
Bret
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.