gadgetjay Posted February 1, 2017 Posted February 1, 2017 I know this has been asked before but I cannot make head nor tail of the answers! I am trying do 2 things: select all objects of a true colour (0,128,255) and delete them select all objects of a true colour (0,255,64) and move them to a new layer. This is easy to do with qselect but would like to automate the process as I have to do this with numerous drawings. if someone could point me in the direction of how to select these colours i'll be good to go! Quote
Tharwat Posted February 1, 2017 Posted February 1, 2017 Hi, Try this; (defun c:Test ( / sel ind ent ) ;; Tharwat - 01.Feb.2017 ;; (if (setq sel (ssget '((-4 . "<OR") (420 . 33023)(420 . 65344) (-4 . "OR>")))) (while (setq ent (ssname sel 0)) (if (= (cdr (assoc 420 (entget ent))) 33023) (entdel ent) (entmod (append (entget ent) '((8 . "New Layer")))) ) (ssdel ent sel)) ) (princ) ) Quote
gadgetjay Posted February 1, 2017 Author Posted February 1, 2017 Thanks Tharwat, This helps a great deal! by the code I can see how to get the true colour number (0,128,255) = (0x65536 + 128x256 + 255 = 33023).. But looking at your code, it would have taken me weeks to get there! Is there a way to automate this rather then selecting by object/window? Quote
Tharwat Posted February 1, 2017 Posted February 1, 2017 Thanks Tharwat, You're welcome. Is there a way to automate this rather then selecting by object/window? Yes, but you need to get sure that all layers in your drawings are Unlocked to allow the objects on true color (0,255,64) to move to New Layer. Add the following to previous posted codes. (if (setq sel (ssget [color="red"]"_X"[/color] '((-4 . "<OR") ..... Quote
gadgetjay Posted February 1, 2017 Author Posted February 1, 2017 Thanks that's perfect - i'll get you a Shisa next time you're down this end of town! Quote
Tharwat Posted February 1, 2017 Posted February 1, 2017 Thanks that's perfect - i'll get you a Shisa next time you're down this end of town! Unfortunately I don't smoke Shisha at all. And thanks for the invitation. Have a nice day. 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.