Quick to create a unique material for each layer? (rendering with lumion)

Is there a quick way to have each layers and sublayer have a unique color?

I am working with rhino / lumion. In order to change thematerials of objects in Lumion each object with a different material needs to have a different material in Rhino. It is not possible to select an object in Lumion
I am now spending hours sometimes to just create randomly colored materials for all objects ( layers ) in rhino. Very boring work.

would be great if there is a script for this or something to speed up workflow.

Thanks!

This is a script @stevebaer made for me a long time ago that does unique materials by objects. Maybe @pascal can make it work on layers?
uniquematerials.py (2.0 KB)

I will have a look…

-Pascal

@jonas.samson - do the materials need to be different colors, or is it enough that each is its own unique named material in Rhino, even if they all look the same?

-Pascal

Hi Pascal,

Thanks for looking in to this! I had to check this, but yes only a unique name should suffice. No need to have unique colors.

Hi Jonas - see how this works -

unique_layer_materials.py (580 Bytes)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"

-Pascal

2 Likes

Hi. I’m also working on a gh script to solve the issue with the different layer materials for exporting to lumion.Unfortunately it works fine with changing only the material name to unique names.

But when you save the rhino file and reopen it. There is a bug that all the materials with the same color are purged. Let’s say all layers with the same color white are one material again. Is it a bug in rhino 7?

Thanks

Hi Pascal.

This is perfect! Does exactly what it should.
You made me very happy today.

Thanks so much for this!

Best,
Jonas

I just made an account to say thank you. Works like a charm!