Assign Objects to Individual Layers


Does anyone know of a way either existing in Rhino 5 or with script to automatically assign all objects in a scene to a new layer of its own?

I ask because if you import a 3dm into Keyshot (not using the plugin within Rhino), the objects are either grouped by material as assigned in Rhino or by layer. This is less than ideal if you plan to animate and want to move objects, because as far as I can tell they cannot be ungrouped.

So a simple solution would be to assign each object to its own layer. It’s a bit brute force but it would solve the problem.

Hi Mathew,

This script will distribute all select-able objects (not hidden or locked) to individual layers with a random color and sequential name.
ObjectsToLayers.rvb (1 KB)

EDIT: I created an updated script as per request in another topic:

To run it you can drag-drop if over rhino.
Be aware that with many objects it can be time consuming; make sure to keep a good backup copy of your file.

Let me know what you think.


Perfect! Exactly what I wanted, thanks very much Willem!

1 Like

Any way the layers can be named based on the object? Im importing a bunch of STLs into a file and need them to be randomly colored and all on their own self titled layer.

The original script you posted is fantastic, but for me its only halfway there.

Hi Ted,

Have a look at this version.
It will try of the (objects) for a layer have a name, and if so give the layer that name.
If there already ois a layer with that name; it is numbered.

ObjectsGroupsToNamedLayers.rvb (2.8 KB)


1 Like

Hi Willem,

Sorry for bringing up an old tread. The script you wrote is almost what I really need, but instead of assigning the individual objects into layers, is it possible to assign layers based on the groups?

It doesn’t sound very hard, but my scripting is terrible. I don’t even now where to start! Your help would be greatly appreciated. Thanks!


Hi Oscire,

My time is limited at the moment, so I cannot be of help.
Does the script not do what you need: grouped objects to layers?
Can you elaborate on what the exact function needs to be, it might be someone else can be of help.