Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change each object entity from bylayer to manual properties

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
Anonymous
1149 Views, 7 Replies

Change each object entity from bylayer to manual properties

Hi All, 

 

I have a good one for you and would be very apprecative of a good lisp to help me out.  I need a routine that takes the properties of all the layers in a drawing and applies them to each individual entity in that drawing.  For example, if I have a line with properties that are all "bylayer" but in the layer manager the color is set to color 1, dashed, lineweight 0.035mm... how do I get it to where if I click the line the manual properties for that object are changed to color 1, dashed, and lineweight 0.035mm.  I'm looking for an automated process that will be able to select all objects within a drawing and have their manual properties changed.

 

Your help is much apprecaited.

 

Thanks! 

7 REPLIES 7
Message 2 of 8
Kent1Cooper
in reply to: Anonymous


@ksmith5 wrote:

....  I need a routine that takes the properties of all the layers in a drawing and applies them to each individual entity in that drawing.  For example, if I have a line with properties that are all "bylayer" but in the layer manager the color is set to color 1, dashed, lineweight 0.035mm... how do I get it to where if I click the line the manual properties for that object are changed to color 1, dashed, and lineweight 0.035mm.  I'm looking for an automated process that will be able to select all objects within a drawing and have their manual properties changed.

....


The attached may give you a start, at least.  It was built to do pretty much just that to all entities in Block definitions, [and also to put them all on Layer 0, which can easily be removed], but the (while) function could be pulled out and adapted to work on all entities in the drawing instead.  It applies only color and linetype, but lineweight could be added easily enough.  Are you capable of doing such modifications yourself?

Kent Cooper, AIA
Message 3 of 8
Anonymous
in reply to: Kent1Cooper

I'm definaltely a rookie when it comes to writing these things.  I'm trying to learn, but this looks a bit advanced for my level.  Would it be possible to help me out with it?

Message 4 of 8
pbejse
in reply to: Anonymous


@ksmith5 wrote:

Hi All, 

 

I have a good one for you and would be very apprecative of a good lisp to help me out.  I need a routine that takes the properties of all the layers in a drawing and applies them to each individual entity in that drawing.  For example, if I have a line with properties that are all "bylayer" but in the layer manager the color is set to color 1, dashed, lineweight 0.035mm... how do I get it to where if I click the line the manual properties for that object are changed to color 1, dashed, and lineweight 0.035mm.  I'm looking for an automated process that will be able to select all objects within a drawing and have their manual properties changed.

 

Your help is much apprecaited.

 

Thanks! 


Try this ksmith5

 

(defun c:chp (/ Layers eprop ss i e cl)
;;	pBe Aug 13 2014		;;;
  (setq	Layers (vla-get-layers
		 (vla-get-ActiveDocument (vlax-get-acad-object))
	       )
	eprop  '("LineWeight" "Linetype" "Color")
  )
  (if (setq ss (ssget ":L"))
    (repeat (setq i (sslength ss))
      (setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
      (setq cl (vla-item layers (vla-get-layer e)))
      (mapcar '(lambda (a b) (vlax-put e a b))
	      eprop
	      (mapcar '(lambda (p) (vlax-get cl p)) eprop)
      )
    )
  )
  (princ)
)
(vl-load-com)

 HTH

 

Message 5 of 8
Anonymous
in reply to: pbejse

That's perfect!  Thanks Pbejse.

Message 6 of 8
hmsilva
in reply to: pbejse

Nicely coded, pBe!

Henrique

EESignature

Message 7 of 8
pbejse
in reply to: Anonymous


@ksmith5 wrote:

That's perfect!  Thanks Pbejse.


You are welcome, Glad i could help

 


@hmsilva wrote:
Nicely coded, pBe!

Henrique

Thank you for the kudos Henrique. 🙂

 

Cheers

Message 8 of 8
hmsilva
in reply to: pbejse

You're welcome, pBe! 🙂

Cheers

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost