svorgodne Posted February 9, 2016 Posted February 9, 2016 Is it possible to get a list from all layer filters within a drawing through autolisp? So far I can create them by: (command "._-layer" "_filter" "_new" "_group" "" "0*" "0" "s" "All" "" ) but I cannot get the list from them Quote
satishrajdev Posted February 9, 2016 Posted February 9, 2016 If I understand you clearly try this :- (defun layerlist (/ a b) (if (setq a (tblnext "layer" t)) (while a (setq b (cons (cdr (assoc 2 a)) b) a (tblnext "layer") ) ) ) (reverse b) ) Quote
rkmcswain Posted February 9, 2016 Posted February 9, 2016 Here is a starting point (dictsearch (vlax-vla-object->ename (vla-GetExtensionDictionary (vla-get-layers (vla-get-activedocument (vlax-get-acad-object) ) ) ) ) "ACAD_LAYERFILTERS" ) And some more stuff you'll probably be interested in here: http://www.cadtutor.net/forum/showthread.php?61032-Layer-Properties-Filters Quote
rkmcswain Posted February 9, 2016 Posted February 9, 2016 If I understand you clearly try this That returns a list of Layers. Quote
svorgodne Posted February 9, 2016 Author Posted February 9, 2016 Thank you both... I think I didn't make myself clear enough. What I need is a Layer Filter List not only a Layer List This is what I mean... Thanks in any case. I'll keep on looking for a solution in the meantime. svorgodne Quote
svorgodne Posted February 9, 2016 Author Posted February 9, 2016 This is the result when I paste the function directly to the textscr (-1 . ) (0 . "DICTIONARY") (5 . "45B8") (102 . "{ACAD_REACTORS") (330 . ) (102 . "}") (330 . ) (100 . "AcDbDictionary") (280 . 0) (281 . 1) Am I doing something wrong? Am I supposed to get the Fiter names from the layers? Thanks again. I'll keep on trying. At least I solve it by resetting everytime the filters although this is not precisely what I want. I want to apply only the missing filters and not all of them. Svorgodne Quote
Lee Mac Posted February 9, 2016 Posted February 9, 2016 Consider the following function to list all Layer Group Filters: (defun LM:grouplayerfilters nil ( (lambda ( foo ) (foo (entget (cdr (assoc 330 (entget (tblobjname "layer" "0"))))))) (lambda ( enx / dic itm rtn ) (and (setq dic (cdr (assoc 360 (member '(102 . "{ACAD_XDICTIONARY") enx)))) (setq dic (cdr (assoc -1 (dictsearch dic "aclydictionary")))) (while (setq itm (dictnext dic (not itm))) (if (= "AcLyLayerGroup" (cdr (assoc 1 itm))) (setq rtn (cons (cons (cdr (assoc 300 itm)) (foo itm)) rtn)) ) ) ) (reverse rtn) ) ) ) Since Group Filters may be nested, if your drawing were to contain Layer Group Filters in the following structure: The above function would return the following: _$ (LM:grouplayerfilters) (("Group Filter1" ("Group Filter4") ("Group Filter5")) ("Group Filter2" ("Group Filter6")) ("Group Filter3")) Quote
svorgodne Posted February 10, 2016 Author Posted February 10, 2016 Thanks Lee, As usual, you are always the "lifesaver". I owe you some beers already. Cya Svorgodne Quote
Lee Mac Posted February 10, 2016 Posted February 10, 2016 You're welcome Svorgodne - I'm glad it helps. Quote
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.