Jump to content

Filter a Layer List for List Box


waders

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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])

Link to comment
Share on other sites

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-...

Link to comment
Share on other sites

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'~

Link to comment
Share on other sites

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'~

Link to comment
Share on other sites

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-*")

Link to comment
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...