Jump to content

Select objects in all layer if ........


reza

Recommended Posts

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

  • Like 2
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

  • Like 3
  • Agree 1
Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

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