New Layer with random color

Hi all!

Someone requested this feature in another forum post:

A toggle that allows new layers to be created with random display colors like Illustrator

I thought it would make for an interesting little coding challenge! So here is my contribution!

As usual drag and drop onto Rhino. Toggle functionality on and off by typing the command ‘NewLayerRandomColor’.

All feedback is greatly appreciated!

Enjoy!

GM

NewLayerRandomColor.rhp (8.5 KB)

So you made a function that alters Rhino’s new layer behavior and is sticky?

I could not test it on my laptop as it seems it requires the unreleased SR10.

Update to the latest service release candidate.

Although I would’ve expected this to work regardless.

G

Interesting plugin. Thanks for sharing it.
Here a small button which works on older releases of Rhino 5 too:

drop it onto Rhino:
addLayerRandomColor.rui (9.2 KB)

OH MY GOD DREAMS CAN COME TRUE!

I requested this for the first time 5 years ago. I seriously thought it was impossibile.This will save SO MUCH TIME. and make models so much clearer. thank you!

I want to give you a present.

@ATH, @djordje Here is the plugin for the current Rhino Service Release.

Nice button @djordje!

But the plugin below directly changes Rhino’s New Layer functionality. Which means that when you click the standard new layer button in the palette (or hit your favourite shortcut) the cursor defaults directly to to the layer name in order to rename it immediately after creation.

NewLayerRandomColor.rhp (8.5 KB)

2 Likes

@Holo, see above to download the plugin for the current service release. :wink:

1 Like

Aaaaaaah!!! Thankyou so much.

Steve

1 Like

Hmm- popular item - @dale, what do you think?
http://mcneel.myjetbrains.com/youtrack/issue/RH-29129

-Pascal

4 Likes

have you considered adding this as default to 6? or at least as a built in option?

Love this plugin but it does not work with the v6 build… anyway to make that happen?

I think this is a Very usefull feature, im currently using the Pascal’s ExplodeBlockToLayer script a lot , i think it will be also usefull to have a feature that assigns a Random color to the Layers on the scene, when i import an STP all the Layers have the same colour, and its helpfull to have them with different colors so you can differenciate between parts

maybe One random color for each main layer and adding variants of the same color for every sublayer

E.g:

1- Random color (40 to 60% Lightness, 80 to 100% Saturation)
1.1 - Hue variant -20° to 20°
1.1.1 - Saturation Variant (avoiding values close to 0 and 100%)
1.1.1.1 - Lightness Variant

2 Likes

Here is a script that will randomize layer colors… either all layers in the file or a selected group… does not pay attention to sublayer hierarchy though, all colors are random…

RandomColorLayers.py (869 Bytes)

–Mitch

5 Likes

@Helvetosaur - You’re awesome! thank you so much!

*Bump this topic, has anything happened regarding a new color for each new layer?

Could be set to random, or a list of user predefined colors?

Could even cycle through all the default Rhino colors?

Thanks, Arkadius

Hi Arkadius - a script is your best bet here.

-Pascal

1 Like

Thanks Pascal, I have used this above script with success.

I know it is a pretty old toppic but i’m looking for this exact same function in rhino and the link to the script is not working anymore. Has anything happened about this request? Can I at least have acces to Guido’s plugin?
thanks
quentin

1 Like

Hey Quentin, can you msg me? I was just digging through this old script myself just the other day. Can share it with you.

Hey @q.andreotti,

Here is a simple Python script that will create a new layer with a pseudo-random color.

add_random_color_layer.py (1.2 KB)

To use, just run Rhino’s RunPythonScript command and select the file.

– Dale