tsotzo Posted August 15, 2018 Posted August 15, 2018 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 Quote
Grrr Posted August 15, 2018 Posted August 15, 2018 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. Quote
tsotzo Posted August 15, 2018 Author Posted August 15, 2018 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! Quote
Tharwat Posted August 15, 2018 Posted August 15, 2018 (list (assoc 8 ed) (assoc 62 ed)) Are enough. Quote
Tharwat Posted August 15, 2018 Posted August 15, 2018 You are right, Tharwat, thanks! You are most welcome. 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.