harrison-matt Posted October 27, 2010 Share Posted October 27, 2010 All, I am wondering how to access all of the layers in a document using either Vlisp or DXF if possible. I am trying to grab layers that fit a particular string with wildcards and i need a list of all layers in the doc to do soo. Any suggestions? Thanks, Matt Quote Link to comment Share on other sites More sharing options...
harrison-matt Posted October 27, 2010 Author Share Posted October 27, 2010 Well, I have figured it out: (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vlax-for lay (vla-get-Layers doc)(setq layers (cons (vla-get-name lay) layers))) (setq laylist (acad_strlsort layers)) But now i am lost..... I am trying to filter a particular string from the list into another list: the string is "G-ANNO-REVC-" in one list and "G-ANNO-REVD-" in another list... any thoughts? Matt Quote Link to comment Share on other sites More sharing options...
alanjt Posted October 27, 2010 Share Posted October 27, 2010 wcmatch ,,,,,,,,,,,,,,,,,,,,, Quote Link to comment Share on other sites More sharing options...
Tharwat Posted October 27, 2010 Share Posted October 27, 2010 (setq lays (tblsearch "LAYER" "G-ANNO-REVD-")) Quote Link to comment Share on other sites More sharing options...
harrison-matt Posted October 27, 2010 Author Share Posted October 27, 2010 Right Wild Card Match, I still need to filter the list... I could figure this out if i take enough time.... if i had enough time... Quote Link to comment Share on other sites More sharing options...
harrison-matt Posted October 27, 2010 Author Share Posted October 27, 2010 Here is what i have, the wcmatch is still new to me, how can the return T be of use... (vl-load-com) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vlax-for lay (vla-get-Layers doc)(setq layers (cons (vla-get-name lay) layers))) (setq laylist (acad_strlsort layers)) (foreach name laylist (wcmatch name "G-ANNO-REV*")) Please i am in need of educating in regards to both foreach and wcmatch. Matt Quote Link to comment Share on other sites More sharing options...
harrison-matt Posted October 27, 2010 Author Share Posted October 27, 2010 hmmm.... how about a list of "T" and "nil" for each wcmatch... (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vlax-for lay (vla-get-Layers doc) (setq layers (cons (vla-get-name lay) layers))) (setq Tlist (mapcar '(lambda (name) (wcmatch name "G-ANNO-REV*")) Layers)) I am brain dead.... but i'll keep pondering please HELP! Thanks, Matt Quote Link to comment Share on other sites More sharing options...
harrison-matt Posted October 27, 2010 Author Share Posted October 27, 2010 Here is what it is that i am tyring to create from this list. The list of layers that is created is going to be used for a pop up list in DCL I will use that selection to pass arguments to turn on/off/isolate/invert isolate the selected element from the list. I just need the dang list to build the rest of the dialog. I can get a list of all the layers... Maybe not the most effective but hey its a list! And now i need to filter that list just to contain items that are wcmatches of G-ANNO-REV*. Matt Quote Link to comment Share on other sites More sharing options...
lpseifert Posted October 27, 2010 Share Posted October 27, 2010 one way... (vlax-for Lyrs (vla-get-Layers (vla-get-activedocument (vlax-get-acad-object))) (setq lst (if (wcmatch (strcase (vla-get-name Lyrs)) (strcase "G-anno*")) (cons (vla-get-name Lyrs) lst) ) ) (setq laylst (acad_strlsort lst)) ) 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.