Jump to content

Rename layer by adding suffix with line type and color


Recommended Posts

Posted

I would like to ask if it is possible to rename the layer names in dwg adding also line thickness (0.05, 0.18 etc.) and color number (10, 20, (240,212,230) 56 etc.. )
Example : Wall       To        Wall_0.05_250
                  Water    To       Water _0.18_200_220_160

Thank you.
 

Posted
13 hours ago, ronjonp said:

Answer HERE.

very nice.
but rgb color is translated to indexed color. Possible to have rgb or book color name?
Thank you

Posted
22 hours ago, harinezumi said:

but rgb color is translated to indexed color. Possible to have rgb or book color name?

 

The solution is in the archive.

 

 

replayer.png

RepLayer.zip

Posted
On 8/29/2019 at 4:40 AM, harinezumi said:

very nice.
but rgb color is translated to indexed color. Possible to have rgb or book color name?
Thank you

Sure .. something like this:

(defun c:foo (/ el)
  (vlax-for l (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
    (setq el (entget (vlax-vla-object->ename l)))
    (vl-catch-all-apply
      'vla-put-name
      (list
	l
	(strcat	(vla-get-name l)
		"_"
		(if (minusp (vla-get-lineweight l))
		  "Default"
		  (itoa (vla-get-lineweight l))
		)
		"_"
		(vl-princ-to-string
		  (cond	((cdr (assoc 430 el)))
			((assoc 420 el)
			 (mapcar '(lambda (x) (vlax-get (vla-get-truecolor l) x)) '(red green blue))
			)
			((cdr (assoc 62 el)))
		  )
		)
	)
      )
    )
  )
)
(vl-load-com)

 

  • Like 1
Posted
On 8/30/2019 at 11:41 AM, maratovich said:

 

The solution is in the archive

thank you

Posted
On 8/30/2019 at 4:26 PM, ronjonp said:

Sure .. something like this:

 

Thank you

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