Originally Posted by
jaberwok
Remembering filter settings would be good, too.
[I put each xref on a separate layer and use the inverted xref filter - which never sticks]
I added a Filter Drop-down to my custom Layers panel with the AutoCAD commands LayerSaveFilterTree and LayerLoadFilterTree as well as a lisp macro that loads a custom set of xref filters.
Code:
; (load "LayFilterAdd.lsp")
; ^C^C^P(or LayFilterAdd (load "LayFilterAdd.lsp"));(LayFilterAdd)
; Save, close and reopen the DWT or DWG for the Filters to be put into alphabetical order.
(defun LayFilterAdd (/ collection names)
(setq names (list ""))
(if (not (vl-catch-all-error-p (setq collection (vl-catch-all-apply
(function (lambda () (vla-item (vla-getextensiondictionary (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))) "ACAD_LAYERFILTERS")))
))))
; (vlax-for item collection (setq names (cons (strcase (vla-get-name item)) names))))
(vlax-for item collection (setq names (cons (vla-get-name item) names))))
names
(or(member "NODE" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"*-NODE*\"" "NODE" "X" nil))
(or(member "Sections" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"C-ROAD-SEC*\"" "Sections" "X" nil))
(or(member "Profile" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"C-ROAD-PROF*\"" "Profile" "X" nil))
(or(member "Topo" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"C-TOPO*\"" "Topo" "X" nil))
(or(member "CALC Points" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"V-NODE-CALC\"" "CALC Points" "X" nil))
(or(member "Only xrefs" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"*|*\"" "Only xrefs" "X" nil))
(or(member "No xrefs" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"~*|*\"" "No xrefs" "X" nil))
(or(member "Linetype" names)(command "._-layer" "filter" "new" "property" "All" "LINETYPE==\"~Continuous\"" "Linetype" "X" nil))
; (or(member "No NCS" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"~@-*\"" "No NCS" "X" nil))
(or(member "No NCS" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"~[A,C,E,L,V]-*\"" "No NCS" "X" nil))
(princ "Layer Filter Names » ")(princ names)
(princ "\nSave, close and reopen the DWT or DWG for the Filters to be put into alphabetical order.")
(princ)
); function
(LayFilterAdd)
The added filters are mine, but I cannot recall where I found the original code.
HTH,