Community
I have the below lisp put together (I found it somewhere, probably somewhere here on the discussion group). I have two features I'd like to add:
1. How do I create a layer filter (via lisp) that shows only frozen layers, or only thawed. I know it has to do with the flags attribute of the list definition, but I don't know what values to plugin.
2. How can I create a layer filter that is a sub of another filter? You can do it with the dialog box, so I hope there is a way to do it with lisp.
Example would be a parent filter of "Utilities" and a child filter of "Utilities . Storm"
Here is the code I have so far:
(defun c:laf (/ filtlst lfiltobj safecode safefilt) (vl-load-com) (setq filtlst (list ;;name lay col lt flags lw plot (list "Active Drawing" "~*|*" "*" "*" 0 "*" "*") (list "Civil 3D" "X?-*,Z?-*" "*" "*" 0 "*" "*") (list "Divides I" "H1-*,Hp-*,*|H1-*,*|Hp-*" "*" "*" 0 "*" "*") (list "Divides II" "H2-*,Hp-*,*|H2-*,*|Hp-*" "*" "*" 0 "*" "*") (list "E+S I" "O1-*,Op-*,*|O1-*,*|Op-*" "*" "*" 0 "*" "*") (list "E+S II" "O2-*,Op-*,*|O2-*,*|Op-*" "*" "*" 0 "*" "*") (list "Base" "B?-*,*|B?-*" "*" "*" 0 "*" "*") (list "Grading" "G?-*,*|G?-*" "*" "*" 0 "*" "*") (list "Site" "S?-*,*|S?-*" "*" "*" 0 "*" "*") (list "Utilities" "U?-*,*|U?-*" "*" "*" 0 "*" "*") (list "Landscape" "L?-*,*|L?-*" "*" "*" 0 "*" "*") (list "Lighting" "I?-*,*|I?-*" "*" "*" 0 "*" "*") (list "Profiles" "P*,*|P*" "*" "*" 0 "*" "*") ;is this correct or should it be P-*,Pe-*,Pp-* ?? (list "State . Prop" "?p-*,*|?p-*" "*" "*" 0 "*" "*") (list "State . Ex" "?e-*,*|?e-*" "*" "*" 0 "*" "*") (list "State . Demo" "?d-*,*|?d-*" "*" "*" 0 "*" "*") (list "Util . San" "*-san*" "*" "*" 0 "*" "*") (list "Util . Storm" "*-stm*" "*" "*" 0 "*" "*") (list "Util . Water" "*-watr*" "*" "*" 0 "*" "*") (list "_Frozen" "*" "*" "*" 0 "*" "*") ;need filters for: ; 1st letter ; ...layer properties (all on, all off, all thaw, all frozen ; be sure to sort together in list of layer filters ) lfiltobj (vla-addobject (vla-getextensiondictionary (vla-get-layers (vla-get-activedocument (vlax-get-acad-object) ) ) ) "acad_layerfilters" "acdbdictionary") safecode (vlax-make-safearray 2 '(0 . 6)) safefilt (vlax-make-safearray 12 '(0 . 6))) (vlax-safearray-fill safecode (list 1 1 1 1 70 1 1)) (foreach sublst filtlst (vlax-safearray-fill safefilt (mapcar '(lambda (x) (vlax-make-variant x 8)) sublst)) (vla-addxrecord lfiltobj (nth 0 sublst)) (vla-setxrecorddata (vla-item lfiltobj (nth 0 sublst)) safecode safefilt ) ) (prin1) (princ "\n...All layer filters have been created.") (princ) )