Link multiple layers to one color

Is it possible to Link multiple layers to one color so that when I change the layer color of one the rest also change? Thanks

Yes, but only if they are sub-layers under the primary or “parent” layer.
Set the sub-layer color to By Parent, and leave the object color to By Layer.

Hmmm sadly they are not sublayers , that would require major reorganization, but it may come to that good to know. Is it scriptable somehow???

@John_Brock - How do you set Layer color to ByParent ?

It is possible to have a script that lets you define the source layer and the list of layers that will be linked to its color and store the info in the document. But you will need to manually ‘refresh’ the color when you change it. Would that be of any help ?

~j

that would be hugely helpful! how would I do that? do you have such a script you would share? Many thanks.

Hi @ethank,

I just made a quick attempt at such script - would work best if you assign to a button I think. It was actually possible to make it into one script that gives you few options: LINK (set source layer and list of linked layers), DELETE (remove source layers - the script allows you to have multiple dependencies, REFRESH (changes colors of all linked layers of selected Source layer) REFRESHALL (updates all source and linked layer colors).

See if that works on your end–

Best,

Jarek

LinkLayerColors.rvb (3.6 KB)

Jarek. thats amazing thank you so so so so so much. 3 questions?
Where should I store this script and how to assign it to a button as you recommend?
Thank you! You just saved me many hours and added a lot of flexibility to my model…

Hi @ethank,

I did some more testing and updated the script a bit - now it should automatically detect and not fail if any of the color source layers was deleted (old one would stop with error). Also, there is a switch that would make all the children (and nested children) layers of the linked layers change colors as well.

As for the script installation: with the new script, save it anywhere on your drive, then drag-and-drop into Rhino viewport.
It will add an alias “LinkLayerColors” and from then on it will be autocompleting from command line.

To add a button with it - Right-Click on any of your toolbars empty area, pick “New Button” and under Command (LMB or RMB) type “LinkLayerColors”.

That’s it - hope this one works better.
LinkLayerColors.rvb (5.8 KB)

Best,

~j

1 Like

Wow man that is AMAZING! THANK you so much!~~ :smile:

they should definitely add this function to rhino 6!

Glad it works for you–

As for adding this functionality to Rhino - In my workflow I don’t find it critical but I can imagine a global ‘named colors’, ‘named linestyles’ etc. could be added into Rhino, where each of them would have its own ID and name and if assigned to layer/object, as oppose to ‘normal’ attributes, they will all update once the ‘global’ attribute is changed.

Currently only Materials work that way.

~j

I need something related to this subject but a bit different:
In the layers panel, how can I select all the layers of a certain color, or certain assigned material (not the objects but the layers themselves) , so that I can assign a different color or material all at once ?
The idea is to avoid the manual selection of layers which although @Jarek’s script is great for what it does, it still requires the manual selection of layers at least once when the link is defined.

Interacting with Layer panel via scripting will only work in Rhino 6 (or current WIP).
If you are brave enough to work on your production projects in the in-progress version, scripting that functionality should not be too hard.
I don’t think it is possible in Rhino 5.

–jarek

1 Like

Thank Jarek. I have 6WIP . I’ll give it a shot.