This will delete all named layer filters when loaded.
;; Modified by Chip Harper 09/24/03
;;
;; By R. ROBERT BELL
;;
(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")))
(prompt "\n...")
(prompt "\n***All layer filters have been deleted!***")
(princ)
)
(C:LayerFiltersDelete)
(princ)
What about 14? It came with LMAN, but if I remember correctly, those VLA-*
calls weren't supported yet.
I may be wrong, I'm a bit fuzzy on those "extended" LISP commands. Once upon
a time they were something,
they changed them to something else.....
While I'm at it, if anyone could clear up the history of those commands, say
with a link, I'd also be grateful.
Michael,
As Jurgen pointed out, with rel. 14 you can create only one layer
filter. You CAN create layer states that are saved to file, but that is
not what this thread was referring to, or at least that's what I thought
;-)
Jeff
commands, say
So I'm TOTALLY CONFUSED? Sorry. I thought we were talking about a routine to
delete those nasty named layer states that can only be selected one at a
time for deletion. You were talking about filters applying to the layer
dialogues?
And here is a modified version that asks for the names to delete,
wildcards are allowed.
Jeff
;;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)
)
"ACAD_LAYERFILTERS")))
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.