Jump to content
tsotzo

selection set based on layer and color of a given object

Recommended Posts

tsotzo

Hi,

 

I am trying something like this:

 

(setq ed (entget (car (entsel))))

(setq lyr (cdr (assoc 8 ed)))

(setq clr (cdr (assoc 62 ed)))

 

How can I get a selection set based on layer and color of a given object?

Something like:

(setq objs (ssget "X" '((cons 8 lyr) (cons 62 clr)) ) )

[i know this is not working I write it just to give the idea.]

 

and then change the objects' layer to "0" and color to 2.

 

Thank you in advance

tso

Share this post


Link to post
Share on other sites
Grrr

You almost got it -

For (setq objs ...) check Lee's tutorial on why you need to replace the apostrophe with the list function.

For the selection set manipulation, first study how to iterate a SS.

And lastly check for the entmod, entget, assoc, subst functions.

Share this post


Link to post
Share on other sites
tsotzo

Thank you Grrr!

It was just what I needed!

(defun C:A2 ( / ed ss1 )
(setq ed (entget (car (entsel))))
(setq ss1 (ssget "X" (list (cons 8 (cdr (assoc 8 ed))) (cons 62 (cdr (assoc 62 ed))) ) ) )
(Command "chprop" ss1 "" "LA" "0" "C" 2 "")
)
 

... and great lesson from Lee Mac (as always :) )

 

Cheers!

Share this post


Link to post
Share on other sites
Tharwat

(list (assoc 8 ed) (assoc 62 ed))

Are enough. ;)

Share this post


Link to post
Share on other sites
tsotzo

You are right, Tharwat, thanks! :thumbsup:

Share this post


Link to post
Share on other sites
Tharwat
You are right, Tharwat, thanks! :thumbsup:

 

You are most welcome. :)

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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