Swap Display/Layer colour

I have 500 objects on 6 different layers, each with different colours. I want to tell Rhino to make each object’s display colour the same its layer has.

Is there a quick way?

Select all the objects. In the Properties dialog, the color section will say (varies). Set the color dropdown to “By Layer”. That’s it.

Edit: Or maybe I misunderstood. You want “color by object”, but you want that color to be inherited from the layer color? If so, try the following script…

ColorToObject.py (411 Bytes)

–Mitch

2 Likes

Amazing!!

The script is just what I needed.

Yet what I was hoping to do was to use this in combination with Make2D, to maintain the colours for each line depending on its layer. I turned on “Maintain Source Layers”, hoping that I could run your script afterwards to copy all colours, and then move all objects to a single layer (with correct colours).

But it seems Make2D always puts all “visible lines” on a single layer, and then that won’t have the correct colours of course.

Does that make sense?

I thought “preserve source layers” should leave everything on the original layers… No time to test now…

It does - made a mistake earlier. All good, many thanks!

Hi,

Is there a way to do the converse, ie change the colours in the layers to the display colours in the properties tab?

Thanks
H

What if there are several objects of different colors on the same layer?

Hi Mitch, that’s not the case for me in this instance? H

OK, you can try this and see how it works for you. You will need to select the layers to process, if you want to do this for all layers in the document, let me know. It will take the color of the most recent object on the selected layer(s), objects or layers that are locked or hidden are not affected.

LayerColorFromLastObj.py (457 Bytes)

1 Like

Thanks Mitch. It works great! I’d like to do it for all layers please. Sorry for being lazy/efficient - it’s only 15 layers this time :smirk:. I know I will be doing this often, so will be good to know how.

KR
H

OK…

AllLayerColorsFromLastObj.py (399 Bytes)

2 Likes

Cheers.