Jump to content

Recommended Posts

Posted

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!

Posted

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

Posted

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?

Posted
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") .....

Posted

Thanks that's perfect - i'll get you a Shisa next time you're down this end of town!

Posted
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. :D And thanks for the invitation. :thumbsup:

 

Have a nice day.

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