Jump to content
muntafuner

Change hatch layer according to color

Recommended Posts

muntafuner

Hello from Austria,

 

i have a problem and couldn´t find any answers to this particular problem:

 

I would like to change the layers of multiple hatches in the drawing according to the specific colors.

 

For example:

All hatches ar located on the Layer "Poly_Muster", now i would like to select all hatches with the color 153,76,0 and then they should be changed to the layer "Poly_Mauerwerk", all hatches with the color 128,210,4 to "Poly_Stahlbeton" and so on..

 

is there a solution i can do this with a script or a lisp?

 

Thank you in advance!

 

Kind regards,

Simon

Share this post


Link to post
Share on other sites
BIGAL

Credit 1s t to lee-mac

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

If you look at this (setq Col (cdr (assoc 420 (entget (car (entsel)))))) pick the hatch returns the color number eg 3899588

 

then (LM:True->RGB col) will convert to a list of RGB 

 

Command: (LM:TRUE->RGB col)
(59 128 196)
 

Sou can do a Cond or if then = list variable

Share this post


Link to post
Share on other sites
muntafuner

Thanks for your quick response.

 

I´m sorry but i´m really a beginner with this coding thing..

 

how do i now add the hatches?

Share this post


Link to post
Share on other sites
BIGAL

You post a sample dwg with hatches and a explanation of what color goes on what layer. Only need a few.

Edited by BIGAL

Share this post


Link to post
Share on other sites
muntafuner

Thank you for your response!

 

You find a sample-file in the attachment.

 

As you can see, the hatch with the color "128,210,4" lays on the Layer "Poly_Muster" but it should be on the Layer "Poly_Stahlbeton"; the hatch with the color "153,76,0" lays also on the layer "Poly_Muster" but it should be on the layer "Poly_Mauerwerk"... for example.

 

Thank you in advance for your help an response!

 

Kind regards,

Simon

Test01.dwg

Share this post


Link to post
Share on other sites

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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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