waders Posted September 19, 2012 Posted September 19, 2012 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 Quote
Tharwat Posted September 19, 2012 Posted September 19, 2012 If they are really Xref 's layers , I think you should check if the layer name match this criteria *|* Quote
waders Posted September 19, 2012 Author Posted September 19, 2012 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 Quote
MSasu Posted September 19, 2012 Posted September 19, 2012 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]) Quote
waders Posted September 19, 2012 Author Posted September 19, 2012 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-... Quote
fixo Posted September 19, 2012 Posted September 19, 2012 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'~ Quote
waders Posted September 19, 2012 Author Posted September 19, 2012 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'~ Quote
Lee Mac Posted September 19, 2012 Posted September 19, 2012 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-*") Quote
waders Posted September 19, 2012 Author Posted September 19, 2012 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? Quote
waders Posted September 19, 2012 Author Posted September 19, 2012 Got it! I actually figured it out. Just took out the "not" in the filter. Thanks to everyone that responed so quickly. Quote
Lee Mac Posted September 20, 2012 Posted September 20, 2012 Glad you solved it for yourself waders 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.