fs_AT12 Posted May 27, 2019 Posted May 27, 2019 HI, I have troubles with some drawings. The drawings are reduced to one layer, but all the "information" is still in the drawing but indicated by different colours. Is there a possibility to swap all objects with a specific colour to a new Layer (like colour_name)? Since there are a lot of colours in the dwgs, it is a lot of work selecting all objects with the colour (RGB) and swap them to a new layer manually. can anybody help me? regards Franz Quote
fs_AT12 Posted May 27, 2019 Author Posted May 27, 2019 28 minutes ago, Cad64 said: Have you tried using Quick Select? See HERE. Thank You! This is what I meant doing it manually. There are 60-80 different colours in a drawing. doing it step by step is very time consuming. Quote
Lee Mac Posted May 27, 2019 Posted May 27, 2019 (edited) Here's a start - (defun c:col2lay ( / c i l s x ) (if (setq s (ssget "_X" '((410 . "Model")))) (repeat (setq i (sslength s)) (setq i (1- i) x (entget (ssname s i)) l (cond ( (setq c (cdr (assoc 420 x))) (LM:true->rgb c)) ( (setq c (cdr (assoc 062 x))) (list c)) ( '(256) ) ) ) (entmod (subst (cons 8 (apply 'strcat (mapcar 'strcat '("Layer_""_""_") (mapcar 'itoa l)))) (assoc 8 x) x)) ) ) (princ) ) ;; True -> RGB - Lee Mac ;; Args: c - [int] True Colour (defun LM:true->rgb ( c ) (mapcar '(lambda ( x ) (lsh (lsh (fix c) x) -24)) '(8 16 24)) ) (princ) Edited May 27, 2019 by Lee Mac 2 Quote
Grrr Posted May 27, 2019 Posted May 27, 2019 3 hours ago, Lee Mac said: Here's a start - Elegant solution, Lee! Quote
Lee Mac Posted May 27, 2019 Posted May 27, 2019 30 minutes ago, Grrr said: Elegant solution, Lee! Thanks! Quote
BIGAL Posted May 28, 2019 Posted May 28, 2019 It took a moment to find the layer make very nice Lee. Quote
fs_AT12 Posted May 28, 2019 Author Posted May 28, 2019 Quote 14 hours ago, Lee Mac said: Here's a start - ... Wow, Thank you! This was a big help! one little thing would be great, if it could be implemented to change also the color of the layer to selected colour.... 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.