View Full Version : Layer Properties
yjoel10344227
2012-12-05, 07:56 PM
Is there a way to change layer properties (specifically color) by choosing an object that is on the layer I want to change? Thanks for any help in advance.
rkmcswain
2012-12-05, 08:14 PM
Is there a way to change layer properties (specifically color) by choosing an object that is on the layer I want to change? Thanks for any help in advance.
Not with stock AutoCAD.
We use an add-on named ToolPac that does include this feature.
http://www.dotsoft.com/images/tplaytblprp.png
BlackBox
2012-12-05, 08:19 PM
Welcome to AUGI! :beer:
I just wrote my own (albeit some time ago, could probably use some updating):
(vl-load-com)
(defun c:CLC () (c:ChangeLayerColor))
(defun c:ChangeLayerColor (/ *error*)
(princ "\rCHANGELAYERCOLOR ")
(defun *error* (msg)
(if acDoc
(progn
(vla-endundomark acDoc)
(if regen
(vla-regen acDoc acAllViewports)
)
)
)
(cond ((not msg)) ; Normal exit
((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit)
((princ (strcat " ** Error: " msg " ** ")))
) ; Fatal error, display it
(princ)
)
((lambda (acDoc / ss color oLayers oLayer layers regen)
(vla-startundomark acDoc)
(if (not (setq ss (ssget "_i")))
(progn
(prompt "\nSelect entity on layer to change color: ")
(setq ss (ssget))
)
)
(if (= 1 (sslength ss))
(setq color
(cdr
(assoc 62
(tblsearch "layer"
(cdr (assoc 8 (entget (ssname ss 0))))
)
)
)
)
)
(if (and ss
(princ "\nSelect replacement layer color: ")
(setq color (acad_colordlg (if color color 1) nil))
)
(progn
(setq oLayers (vla-get-layers acDoc))
(vlax-for x (setq ss (vla-get-activeselectionset acDoc))
(if
(not
(vl-position (setq oLayer (vla-item oLayers (vla-get-layer x))) layers)
)
(setq layers (cons oLayer layers))
)
)
(vla-delete ss)
(foreach oLayer layers
(if (or regen
(= :vlax-true (vla-get-lock oLayer))
)
(setq regen T)
)
(vla-put-color oLayer color)
)
(*error* nil)
)
)
)
(vla-get-activedocument (vlax-get-acad-object))
)
)
yjoel10344227
2012-12-05, 08:53 PM
Thanks for the feedback. Is the ToolPac a paid add-on?
yjoel10344227
2012-12-05, 09:08 PM
While we're on the layer subject, I have another issue I was hoping someone had feedback on. Whenever I change a layer in a drawing that is x'ref'd in another drawing, the layer only changes color in the main drawing but not in the other drawings that have it xref'd. Anyway to have the the color change not only in the drawing itself, but every drawing that has it xref'd in? I hope that makes sense.
BlackBox
2012-12-05, 09:11 PM
Consider the VISRETAIN (http://exchange.autodesk.com/autocad/enu/online-help/browse#WS1a9193826455f5ffa23ce210c4a30acaf-4e05.htm) system variable, and/or Layer States (http://exchange.autodesk.com/autocad/enu/online-help/browse#WS73099cc142f4875513fb5cd10c4aa30d6b2cd0.htm)
kimlance
2012-12-05, 11:09 PM
If I understand you right when you change the color in in xref dwraing it will not change color in your host drawing. Your host drawing controls the colors. That is if you've already created it
jaberwok
2012-12-05, 11:11 PM
If I understand you right when you change the color in in xref dwraing it will not change color in your host drawing. Your host drawing controls the colors. That is if you've already created it
Only if VISRETAIN is set to 1 in the host.
BlackBox
2012-12-05, 11:43 PM
If I understand you right when you change the color in in xref dwraing it will not change color in your host drawing. Your host drawing controls the colors. That is if you've already created it
Only if VISRETAIN is set to 1 in the host.
... Further, VISRETAIN = 1 in the host drawing will control all layer properties (i.e., On/Off, Freeze/Thaw, Color, Plottable, etc.), which is why we make automations available for users to employ Layer States for any drawing where VISRETAIN = 1 (for consistency).
StDoodle
2012-12-06, 05:42 AM
Sorta on topic... how does using Layer States play with having VISRETAIN =1 & using the sheet set manager? Without using Layer States, setting VISRETAIN = 1 to fix xref layers borks every layout I put in using SSM, which is why I have a big red note on my marker board that says "DON'T EVER F*** WITH VISRETAIN!"
BlackBox
2012-12-06, 07:44 AM
VISRETAIN is a drawing level system variable, and has nothing to do with SSM. Layer states can be applied in any drawing, the difference of if those settings persist is determined by VISRETAIN.
If you have a different setting when creating drawings via SSM, that somehow differ from that which is created by QNEW, then methinks you simply neglected to properly configure SSM to use the same drawing template specified in the Files tab of the Options dialog for your given Profile.
rkmcswain
2012-12-06, 03:33 PM
Thanks for the feedback. Is the ToolPac a paid add-on?
Yes. See: http://www.dotsoft.com/toolpac.htm
rkmcswain
2012-12-06, 03:35 PM
Welcome to AUGI! :beer:
I just wrote my own (albeit some time ago, could probably use some updating):
Just needs support for truecolor! :-)
BlackBox
2012-12-06, 04:21 PM
Just needs support for truecolor! :-)
That can be added, if you like?
We don't use TrueColor here for production (hence it's absence in my offering).
Tom Beauford
2012-12-07, 04:19 PM
Is there a way to change layer properties (specifically color) by choosing an object that is on the layer I want to change? Thanks for any help in advance.
If you're using 2011 or newer with the ribbon pick the object, then the layer combo control, then the color box and set the layer color to whatever you want. The layer combo control is the first thing I add to my quick access toolbar with each upgrade.
rkmcswain
2012-12-07, 07:32 PM
If you're using 2011....
Good one Tom. I forget about that.
StDoodle
2012-12-07, 08:56 PM
VISRETAIN is a drawing level system variable, and has nothing to do with SSM.
Ok, make a new project with some model space views that have different layer snapshots saved with them, and place these views on sheets through SSM. Then, make a change to some layer properties in the model. With VISRETAIN = 1, those changes won't propagate to the sheet views. So, to get your xref'd layer properties in sync, change VISRETAIN = 0. Now reload your xref; what happened to the layer snapshots?
My question was whether there's an easy way to make use of layer snapshots to avoid what happens above, as I'm unfamiliar with using them.
BlackBox
2012-12-07, 10:16 PM
Ok, make a new project with some model space views that have different layer snapshots saved with them, and place these views on sheets through SSM. Then, make a change to some layer properties in the model. With VISRETAIN = 1, those changes won't propagate to the sheet views. So, to get your xref'd layer properties in sync, change VISRETAIN = 0. Now reload your xref; what happened to the layer snapshots?
My question was whether there's an easy way to make use of layer snapshots to avoid what happens above, as I'm unfamiliar with using them.
By changing VISRETAIN = 0 then reloading your XREF, you've effectively reset your snapshot on-screen.
Now, I am unsure if snapshots == Layer States, but with the latter, one can simply restore the Layer State and all is put back as it was (be sure to set VISRETAIN = 1 for those settings to remain).
Say you have five sheets, each with VISRETAIN = 1 and the same Layer State applied, and you need to make a change to that Layer State. Open the first drawing of the five, and make the necessary changes, and re-save the Layer State. But that doesn't update the other four drawings... For that you'd need to export the Layer State (we use .LAS saved to the project directory), and then open each of the other four drawings, delete your Layer State, and re-import/apply.
This can become cumbersome if you have a large number of drawings, so we've automated the process with tools to expedite using the LayerState-* LISP functions.
HTH
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.