harrison-matt Posted October 27, 2010 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
harrison-matt Posted October 27, 2010 Author 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
Tharwat Posted October 27, 2010 Posted October 27, 2010 (setq lays (tblsearch "LAYER" "G-ANNO-REVD-")) Quote
harrison-matt Posted October 27, 2010 Author 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
harrison-matt Posted October 27, 2010 Author 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
harrison-matt Posted October 27, 2010 Author 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
harrison-matt Posted October 27, 2010 Author 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
lpseifert Posted October 27, 2010 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
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.