reza Posted October 30, 2022 Posted October 30, 2022 (edited) HI Everyone How to select the polylines whose color is by layer. If that only objects whose layer color is set to white are selected. Select Bylayer.dwg Edited October 30, 2022 by reza Quote
Steven P Posted October 30, 2022 Posted October 30, 2022 This handy reference http://lee-mac.com/ssget.html and look at 'ALL' changing his example (0 . "LINE") to be colour ( 62 . "Colour" ) and colour 256 is 'ByLayer' giving you something like (setq ss (ssget "_A" '((0 . "LWPOLYLINE")(62 . 256))) ) will select all polylines that are 'by layer' colour and create a selection set with them for you to do what you want after 2 Quote
reza Posted October 30, 2022 Author Posted October 30, 2022 Dear Steven Thx for reply Okey : we selected all lwpolylines are color by layer and then : I want only selection lwpolylines that are white in color. But how can I select them when their color is by layer Quote
mhupp Posted October 30, 2022 Posted October 30, 2022 That is a little more involved. (defun C:FOO (/ SS layers lay x lst SS1) (setq SS (ssadd)) ;emty selecton set to add entity's to (setq layers (Table "layer")) (foreach lay layers (setq x (entget (tblobjname "layer" lay))) (if (eq (cdr (assoc 62 x)) 7) (setq lst (cons lay lst)) ;add each layer that has color white to a new list ) ) (foreach lay lst (if (setq SS1 (ssget "_X" (list '(0 . "*POLYLINE") (cons 8 lay) '(62 . 256) (cons 410 (getvar 'ctab))))) ;process that 2nd list of layers to see if any (setq SS (acet-ss-union (list SS SS1))) ;polylines are bylayer and add them to ss ) (setq SS1 nil) ; reset so things arn't added twice ) (if (setq SS1 (ssget "_X" (list '(0 . "LWPOLYLINE") '(62 . 7) (cons 410 (getvar 'ctab))))) ;alos find any polylines that are white (setq SS (acet-ss-union (list SS SS1))) ;and add them to SS ) (sssetfirst nil SS) ) ;Written By Michael Puckett (defun Table (s / d r) (while (setq d (tblnext s (null d))) (setq r (cons (cdr (assoc 2 d)) r)) ) ) 3 1 Quote
Steven P Posted October 30, 2022 Posted October 30, 2022 1 hour ago, mhupp said: (setq SS (acet-ss-union (list SS SS1))) Am sure I saw this the other day!... (haven't needed to use it yet myself though) Quote
BIGAL Posted October 30, 2022 Posted October 30, 2022 I am pretty sure if you want color set to bylayer make a selection set ss. Look at each item and check against its LAYER COLOR can ssadd etc and is white then. A 2 step process. May not be super fast. Otherwise get all Layers look at each layer color is it "white" then do ( ssget "X" (list (0 . "*POLYLINE") "(cons 8 layername) (62 . 256))) and ssadd to result repeating for all layers. Quote
reza Posted October 31, 2022 Author Posted October 31, 2022 Thank you all. The code written by mhupp solved my problem. 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.