New Layer with random color

unhandled

#1

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)


#2

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.


#3

Update to the latest service release candidate.

Although I would’ve expected this to work regardless.

G


#4

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)


#5

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.


#6

@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)


#7

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


#8

Aaaaaaah!!! Thankyou so much.

Steve


(Pascal Golay) #9

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

-Pascal


#10

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


#11

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


#12

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


#13

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


#14

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