Jump to content
waders

Filter a Layer List for List Box

Recommended Posts

waders

Hey All,

 

Is there away to filter a layer list so it doesn't show all the layers in a list box. I want to see only the "Xref-*" layers. I do need the wild card because after the hypen the names vary. Also feel free to offer other suggestions or ways to attached code.Thanks

test.dcl

test.lsp

Share this post


Link to post
Share on other sites
Tharwat

If they are really Xref 's layers , I think you should check if the layer name match this criteria *|*

Share this post


Link to post
Share on other sites
waders

Thanks for looking at this Tharwat. To clarify what I should have claified orginally. The layers I'm trying to filter are the layers that the xrefs are on, not the layers from the xrefs. I'm controlling those layers in another code. My goal is to have a dialog box open w/ just the layer the Xref's are on ie. Xref-E1-Ei01, Xref-E1-Ei02.... and freeze all layers starting w/ Xref-* and leave the layer the user selected thawed. Does that make sence.. Thanks

Share this post


Link to post
Share on other sites
MSasu

Something like this?

[color=blue](setq MyLayersList '("Xref-E1-Ei01" "Dimensions" "Xref-E1-Ei02"))[/color]

(vl-remove-if '(lambda(x) (not (wcmatch x "Xref-*"))) [color=blue]MyLayersList[/color])

Share this post


Link to post
Share on other sites
waders

Yes and no. How could I get....

[color=#0000ff](setq MyLayersList '("Xref-E1-Ei01" "Dimensions" "Xref-E1-Ei02"))[/color]

to read all the layers then filter all but the ones that begin w/ Xref-...

Share this post


Link to post
Share on other sites
fixo

Try this function just add filter to exclude desired layers by match:

 

 
;; Jeff Mishler
;; filtered layer list
(defun LAYERS (filter / d r)
(while (setq d (tblnext "layer" (null d)))
(if (not (wcmatch (cdr (assoc 2 d)) filter))
(setq r (cons (cdr (assoc 2 d)) r))
)
)
r
)

 

~'J'~

Share this post


Link to post
Share on other sites
waders

Sorry you loss me on this one....

Try this function just add filter to exclude desired layers by match:

 

 
;; Jeff Mishler
;; filtered layer list
(defun LAYERS (filter / d r)
(while (setq d (tblnext "layer" (null d)))
(if (not (wcmatch (cdr (assoc 2 d)) filter))
(setq r (cons (cdr (assoc 2 d)) r))
)
)
r
)

 

~'J'~

Share this post


Link to post
Share on other sites
Lee Mac

Call

;; Jeff Mishler
;; filtered layer list
(defun LAYERS ( filter / d r )
   (while (setq d (tblnext "layer" (null d)))
       (if (not (wcmatch (cdr (assoc 2 d)) filter))
           (setq r (cons (cdr (assoc 2 d)) r))
       )
   )
   r
)

With:

(LAYERS "Xref-*")

Share this post


Link to post
Share on other sites
waders

Thanks Lee! Got! But it does exactly the opposite of what I want it to do. How can I call only the "Xref-*" layers and ignore the rest?

Share this post


Link to post
Share on other sites
waders

Got it! I actually figured it out. Just took out the "not" in the filter. Thanks to everyone that responed so quickly.

Share this post


Link to post
Share on other sites
Lee Mac

Glad you solved it for yourself waders :thumbsup:

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...