Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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?

Posted

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

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