Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is there way to apply a layer's properties to an object?

13 REPLIES 13
SOLVED
Reply
Message 1 of 14
Anonymous
2096 Views, 13 Replies

Is there way to apply a layer's properties to an object?

I am trying to create a legend for all the objects and linetypes in a drawing but want all the items to be on a single layer. Currently I have to manually apply the properties of the layer (color, lineweight, linetype, etc...) to the object so that they will plot the same.

 

I know the "setbylayer" command will strip all the objects properties and set them to bylayer, I want something kind of like the opposite.

 

If I use the "match properties" command it applies all the selected objects properties, but they are always "bylayer" I need something that gets the layers properties and applies it to the object.

 

I hope this makes sense, and thanks for any insight.

 

Mike

13 REPLIES 13
Message 2 of 14
Anonymous
in reply to: Anonymous

With the objects 'within' the block located on LAYER 0 and set to BYLAYER, the object will inherit the layer properties they are located on.

 

Message 3 of 14
rkmcswain
in reply to: Anonymous

There is no built-in command to do this, but it could be done with a lisp (or other lang) routine.

R.K. McSwain     | CADpanacea | on twitter
Message 4 of 14
Neil47
in reply to: Anonymous

Message 5 of 14
john.vellek
in reply to: Anonymous

Hi @Anonymous,

 

It sounds like you are on the right track with match properties. However, after using this feature, if you isolate one layer at a time is it possible qselect all the objects and set the remaining property to the selected items?

 

Please select the Accept as Solution button if my post solves your issue or answers your question.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
Message 6 of 14
Anonymous
in reply to: Anonymous

I am wanting to transfer the layer properties such as color, lineweight, linetype, etc... to the object.

 

Example: We have the project boundary drawn as a polyline that all of it's properties are set to "bylayer".

It is on the layer named C-BNDY-LINE.

That layer has the following properties.

Color: 6

Linetype: phantom2

Lineweight: 0.60mm

Transparancy: 0

 

I want to transfer the properties of the C-BNDY-LINE layer to a polyline drawn on the Layer called C-ANNO-LGND which has different properties.

Message 7 of 14
Anonymous
in reply to: Anonymous

Select the polyline, then override those properties in the PROPERTIES PALETTE.

 

Message 8 of 14
Anonymous
in reply to: Anonymous

That is what I do currently. I am just trying to setup a master template with all our firms objects and linetypes and was looking for a more automated way to transfer the properties.

Message 9 of 14
ВeekeeCZ
in reply to: Anonymous

Well, two routines I can offer. Lee Mac's Legend and my SetByLayerReverse... 

Message 10 of 14
GrantsPirate
in reply to: Anonymous

If you are using .STB in your files you simply select the objects and change the plotstyle name with properties.


GrantsPirate
Piping and Mech. Designer
EXPERT ELITE MEMBER
Always save a copy of the drawing before trying anything suggested here.
----------------------------------------------------------------------------
If something I wrote can be interpreted two ways, and one of the ways makes you sad or angry, I meant the other one.

Message 11 of 14
Anonymous
in reply to: ВeekeeCZ

Thank you BeekeeCZ.

 

Works better than expected!!!!

Message 12 of 14
Anonymous
in reply to: Anonymous

Please excuse me for taking this topic back alive, but i found this lisp problematic with "lineweight". When it finds ByLayer value it changes it, but always to "Default", not to value used by layer. Is there any way to fix this up? 

 

By the way this procedure should be build in, with multiple "ByLayer" values in Your drawing MAPEXPORT command becomes quite useless.

Message 13 of 14
ВeekeeCZ
in reply to: Anonymous

wow, I'm using this routine once in awhile, but never noticed... thx.

 

;; If the object's properties color, linetype and lineweight are ByLayer, then these are changed according the layer.

(vl-load-com)

(defun c:SetByLayerReverse (/ *error* adoc layer obj en ss i tcol)
  
  (defun *error* (msg)
    (vla-endundomark adoc)
    (princ msg)
    (princ))
  
  (vla-startundomark (setq adoc (vla-get-activedocument (vlax-get-acad-object))))
  (if (setq ss (ssget))
    (repeat (setq i (sslength ss))
      (setq en (ssname ss (setq i (1- i)))
	    obj (vlax-ename->vla-object en)
	    layer (vla-get-layer obj))
      
      (if (not (assoc 62 (entget en)))
	(progn
	  (vla-put-color obj (cdr (assoc 62 (tblsearch "layer" layer))))
	  (if (setq tcol (assoc 420 (entget (tblobjname "layer" layer))))
	    (entmod (append (entget en) (list tcol))))))
      
      (if (not (assoc 6 (entget en)))
	(vla-put-linetype obj (cdr (assoc 6 (tblsearch "layer" layer)))))
      
      (if (not (assoc 370 (entget en)))
	(vla-put-lineweight obj (cond ((cdr (assoc 370 (entget (tblobjname "layer" layer)))))
				      (-3))))))
  (vla-endundomark adoc)
  (princ)
)
Message 14 of 14
Anonymous
in reply to: ВeekeeCZ

Now works perfectly, many thanks !

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

Post to forums  

Forma Design Contest


Autodesk Design & Make Report