Deby Ferdian Posted April 4, 2016 Share Posted April 4, 2016 Hi, all! Do you know why my filters groups that have been created didn't want to called back from "+LAYER" item sub menu by cursor visual clickable. How can do I should not need to type them anymore each do of my act ? It said: Invalid layer filter name. Please, need help soon! all responce. Will be glad and appreciate ... Quote Link to comment Share on other sites More sharing options...
tombu Posted April 4, 2016 Share Posted April 4, 2016 Are your Filters shown in the Layer Properties Manager? How many Filters are in the Layer Properties Manager? Quote Link to comment Share on other sites More sharing options...
Deby Ferdian Posted April 4, 2016 Author Share Posted April 4, 2016 No, no at all. Just bad notice in command line like I mean an above. Only about 6 or 7 filters tombu. Is it look okey? or this is what be causes it. Quote Link to comment Share on other sites More sharing options...
tombu Posted April 4, 2016 Share Posted April 4, 2016 No problem using it here. Do those Filters work in the Layer Properties Manager? Quote Link to comment Share on other sites More sharing options...
tombu Posted April 4, 2016 Share Posted April 4, 2016 Can you attach a blank drawing with those Filters in it? Quote Link to comment Share on other sites More sharing options...
Deby Ferdian Posted April 4, 2016 Author Share Posted April 4, 2016 Oh.. hayaa! I just remember that if I indeed create them with VLISP it's defun to MLY by Lee Mac on others forum. Here it is, the file what you want and I also attached the VLISP too for sample hope can help ease the burden of the investigation. (defun sdg_CreateLayerFilter (filtlst / lfiltobj safecode safefilt) (vl-load-com) (setq 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 ) SUBLST) ) (vla-addxrecord LFILTOBJ (nth 0 SUBLST)) (vla-setxrecorddata (vla-item LFILTOBJ (nth 0 SUBLST)) SAFECODE SAFEFILT ) ) (prin1) ) (defun MakeLayer ( name colour linetype lineweight willplot bitflag description ) ;; © Lee Mac 2010 (or (tblsearch "LAYER" name) (entmake (append (list (cons 0 "LAYER") (cons 100 "AcDbSymbolTableRecord") (cons 100 "AcDbLayerTableRecord") (cons 2 name) (cons 70 bitflag) (cons 290 (if willplot 1 0)) (cons 6 (if (and linetype (tblsearch "LTYPE" linetype)) linetype "CONTINUOUS" ) ) (cons 62 (if (and colour (< 0 (abs colour) 256)) colour 7)) (cons 370 (if (minusp lineweight) -3 (fix (* 100 (if (and lineweight (<= 0.0 lineweight 2.11)) lineweight 0.0) ) ) ) ) ) (if description (list (list -3 (list "AcAecLayerStandard" (cons 1000 "") (cons 1000 description)) ) ) ) ) ) ) ) (defun MySetXRec (Obj CodeList DataList / ) ; Sets XRecordData. Dxf numbers between 1-369, except 5, 100, 105. ; See help for types and numbers to use. (vla-SetXRecordData Obj (vlax-make-variant (vlax-safearray-fill (vlax-make-safearray vlax-vbInteger (cons 0 (1- (length CodeList))) ) CodeList ) ) (vlax-make-variant (vlax-safearray-fill (vlax-make-safearray vlax-vbVariant (cons 0 (1- (length Datalist))) ) DataList ) ) ) ) ;;--------------------=={ Load Linetype }==-------------------;; ;; ;; ;; Attempts to load a specified linetype from any linetype ;; ;; definition files (.lin) found in the ACAD Support Path ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; lt - name of linetype to load ;; ;;------------------------------------------------------------;; ;; Returns: T if linetype loaded successfully, else nil ;; ;;------------------------------------------------------------;; (defun LM:LoadLinetype ( lt ) (cond ( (tblsearch "LTYPE" lt) ) ( (progn (or acapp (setq acapp (vlax-get-acad-object))) (or acdoc (setq acdoc (vla-get-ActiveDocument acapp))) (or aclts (setq aclts (vla-get-Linetypes acdoc))) (vl-some (function (lambda ( file ) (vl-catch-all-apply 'vla-load (list aclts lt file)) (and (tblsearch "LTYPE" lt)) ) ) (setq *LineTypeDefs* (cond ( *LineTypeDefs* ) ( (apply 'append (mapcar '(lambda ( directory ) (vl-directory-files directory "*.lin" 1)) (LM:str->lst (vla-get-SupportPath (vla-get-Files (vla-get-Preferences acapp))) ";" ) ) ) ) ) ) ) ) ) ) ) ;;-------------------=={ String to List }==-------------------;; ;; ;; ;; Separates a string into a list of strings using a ;; ;; specified delimiter string ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; str - string to process ;; ;; del - delimiter by which to separate the string ;; ;;------------------------------------------------------------;; ;; Returns: A list of strings ;; ;;------------------------------------------------------------;; (defun LM:str->lst ( str del / pos ) (if (setq pos (vl-string-search del str)) (vl-remove "" (cons (substr str 1 pos) (LM:str->lst (substr str (+ pos 1 (strlen del))) del))) (list str) ) ) (defun c:MLY (/ FILTLST LFILTOBJ SAFECODE SAFEFILT) (vl-load-com) (setq FILTLST (list ;; Name Lay col lt flags lw plot (list "@GeneralARM" "*.Ga*" "*" "*" 0 "*" "*") (list "@Assembly" "*.As*" "*" "*" 0 "*" "*") (list "@Sub.Assembly""*.Sb*" "*" "*" 0 "*" "*") (list "Detail" "*.Dt*" "*" "*" 0 "*" "*") (list "Dimension" "*.Dm*" "*" "*" 0 "*" "*") (list "Symbol" "*.Sy*" "*" "*" 0 "*" "*") (list "Sheet" "*.Sh*" "*" "*" 0 "*" "*") (list "Texts" "*.Tx*" "*" "*" 0 "*" "*") (list "Interior" "*.In*" "*" "*" 0 "*" "*") (list "Structure" "*.Sr*" "*" "*" 0 "*" "*") (list "Electrical" "*.El*" "*" "*" 0 "*" "*") (list "Mechanical" "*.Mc*" "*" "*" 0 "*" "*") (list "Piping" "*.Pp*" "*" "*" 0 "*" "*") (list "Outdoor" "*.Ou*" "*" "*" 0 "*" "*") ) 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 ) SUBLST) ) (vla-addxrecord LFILTOBJ (nth 0 SUBLST)) (vla-setxrecorddata (vla-item LFILTOBJ (nth 0 SUBLST)) SAFECODE SAFEFILT ) ) (setq filtlst (list ;;name Lay col lt flags lw plot (list "%Locked" "*" "*" "*" 257 "*" "*") (list "%Hidden" "*" "*" "*" 15 "*" "*") (list "%Frozen" "*" "*" "*" 5 "*" "*") ) ) (sdg_CreateLayerFilter filtlst) (regapp "AcAecLayerStandard") ( (lambda ( lst ) (mapcar 'print (vl-remove-if 'cdr (mapcar (function (lambda ( x ) (if (caddr x) (LM:LoadLinetype (caddr x))) (cons (car x) (apply 'MakeLayer x)) ) ) lst ) ) ) ) '( ; Name Colour Linetype Lineweight Plot? Bitflag Description ( "Window.In" 7 "CONTINUOUS" -3 T 0 "componets") ( "Wood.In.Ou" 1 "CONTINUOUS" -3 T 0 "const" ) ( "Glass.In.Ou" 4 "CONTINUOUS" -3 T 0 "fitting" ) ( "List.In.Ou" 1 "CONTINUOUS" -3 T 0 nil ) ( "Deck.In.Ou.Sr" 252 "CONTINUOUS" -3 T 0 nil ) ( "Base.In.Ou.Sr" 1 "CONTINUOUS" -3 T 0 nil ) ( "Ground.In.Ou.Sr" 24 "CONTINUOUS" -3 T 0 nil ) ( "Bolt.Mc" 252 "CONTINUOUS" -3 T 0 nil ) ( "Block.Sh" 252 "CONTINUOUS" -3 T 0 nil ) ( "Section.Sh" 252 "CONTINUOUS" -3 T 0 nil ) ( "Partition.In.Sr" 7 "CONTINUOUS" -3 T 0 nil ) ( "Elbow.Mc.Pp" 10 "CONTINUOUS" -3 T 0 nil ) ( "Pipe.Pp" 253 "CONTINUOUS" -3 T 0 nil ) ( "Bricks.Sr" 252 "CONTINUOUS" -3 T 0 nil ) ( "Cement.Sr" 252 "CONTINUOUS" -3 T 0 nil ) ( "Plaster.Sr" 252 "CONTINUOUS" -3 T 0 nil ) ( "Roof.Ou.Sr" 252 "CONTINUOUS" -3 T 0 nil ) ( "Weld.Sh" 7 "CONTINUOUS" -3 T 0 nil ) ( "Part.In.Mc.El.Sr.As" 254 "CONTINUOUS" -3 T 0 nil ) ( "Piece.In.Mc.El.Sr.Sb" 252 "CONTINUOUS" -3 T 0 nil ) ( "Path.In.Mc.El.Sr.Ar.As.Sb" 7 "CONTINUOUS" -3 T 0 nil ) ( "Xline-R.Sh" 10 "CONTINUOUS" -3 T 0 nil ) ( "Xpoint.Sh" 7 "CONTINUOUS" -3 T 0 nil ) ( "Dimension.Dm" 230 "CONTINUOUS" -3 nil 0 nil ) ( "Shadow.Sh" 30 "CONTINUOUS" -3 T 0 nil ) ( "Beam.Sr" 160 "CONTINUOUS" -3 T 0 nil ) ( "Column.Sr" 40 "CONTINUOUS" -3 T 0 nil ) ( "NeastingCut.Sr" 1 "ACAD_ISO12W100" -3 T 0 nil ) ( "Plastic.Sr" 252 "CONTINUOUS" -3 T 0 nil ) ( "Steel.Sr" 160 "CONTINUOUS" -3 T 0 nil ) ( "Iron.Sr" 40 "CONTINUOUS" -3 T 0 nil ) ( "Rubber.Sr" 1 "ACAD_ISO12W100" -3 T 0 nil ) ( "Fibber.Sr" 7 "CONTINUOUS" -3 T 0 nil ) ( "Annotation.Tx" 30 "CONTINUOUS" -3 T 0 nil ) ( "Texts.Tx" 7 "CONTINUOUS" -3 T 0 nil ) ( "Mtext.Tx" 7 "CONTINUOUS" -3 T 0 nil ) ( "Line.Sh" 10 "CONTINUOUS" -3 T 0 nil ) ( "Strip.Sh" 30 "CONTINUOUS" -3 T 0 nil ) ( "Dash.Sh" 7 "CONTINUOUS" -3 T 0 nil ) ( "Dot2x.Sh" 7 "CONTINUOUS" -3 T 0 nil ) ( "Connecting.Sh" 10 "CONTINUOUS" -3 T 0 nil ) ( "Arrow.Sh" 10 "CONTINUOUS" -3 T 0 nil ) ( "Breakline.Sh" 10 "CONTINUOUS" -3 T 0 nil ) ( "GeneralARM.Ga" 7 "CONTINUOUS" -3 T 0 nil ) ( "Assembly.As" 254 "CONTINUOUS" -3 T 0 nil ) ( "Sub.Assembly.Sb" 254 "CONTINUOUS" -3 T 0 nil ) ) ) (setq LayDict (vla-GetExtensionDictionary (vla-get-Layers (vla-get-ActiveDocument (vlax-get-Acad-Object))))) (if (vl-catch-all-error-p (setq LayFltDict (vl-catch-all-apply 'vla-Item (list LayDict "AcLyDictionary")))) (setq LayFltDict (vla-AddObject LayDict "AcLyDictionary" "AcDbDictionary")) ) (setq xRec (vla-AddXRecord LayFltDict "Non-XrefLayers")) (MySetXRec xRec'(1 90 300 301) '("AcLyLayerFilter" 1 "Non-Xrefs" "NAME==\"~*|*\"")) (prin1) (princ) (princ) (princ) ) BalnkD for sample.dwg Quote Link to comment Share on other sites More sharing options...
tombu Posted April 4, 2016 Share Posted April 4, 2016 (edited) +LAYER does not work here on your drawing or mine when I select the Filter It says: Invalid layer filter name. I've used this in the past, but it's been a while. Don't know what's wrong? Edited April 4, 2016 by tombu I was wrong! Quote Link to comment Share on other sites More sharing options...
Deby Ferdian Posted April 4, 2016 Author Share Posted April 4, 2016 ahhmm.. tombu Are you doing this with type it all or at the a sub menu you do click it by your pointer of mouse ??? How you do that and get it works to you why in my do is always failed ??? Quote Link to comment Share on other sites More sharing options...
tombu Posted April 4, 2016 Share Posted April 4, 2016 https://knowledge.autodesk.com/support/autocad/troubleshooting/caas/sfdcarticles/sfdcarticles/Error-Invalid-layer-filter-name-received-when-using-the-LAYER-command.html Issue: The user will receive an error stating "Invalid layer filter name" after using the +LAYER command and selecting the layer filter name. Solution: To avoid this behaviour, type in the full name of the layer filter. This will open the Layer Properties Manager palette with the corresponding layer state active. This worked for me. Actually that's the way I used it before in a macro. Quote Link to comment Share on other sites More sharing options...
Deby Ferdian Posted April 4, 2016 Author Share Posted April 4, 2016 So we can't use it by clickable by our mouse.. Alright I'd forgot Don't looking to know? the only way to call back a filter group directly to it. Just type in a full name of the filter group right? am I correct? Macro??? How??? could you tell me tombu if you don't mind to tell program it with macro.. Someone has posted about this, I don't know it was right or not?? (defun c:[color=red][b]SFLG[/b][/color] () (command "_.layer" "_filter" "_set" "Outdoor" "_exit" "") (princ) ) #I hope you understand about my language knowledge that has lacking more then less and Thanks in advance. Quote Link to comment Share on other sites More sharing options...
tombu Posted April 4, 2016 Share Posted April 4, 2016 No lisp required for the Macro: ^C^C+Layer;Detail Will set Detail filter current. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.