Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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!

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