Change Rhino material of layer

I have materials in the material panel in Rhino, and I would like to add them to layers using Grasshopper. The Human plugin has a component to change material for layers, but it only works if some object in Rhino already has that material assigned. I believe this is because the material exists in the “MaterialTable”, but not the “RenderMaterialTable”. Is this correct, and is there a way to add them to the RenderMaterialTable?

I have tried to understand the structure in the API references, but I get confused about the different material tables!

(My workaround so far have been use Python in Grasshopper to run the Rhino command “RenderAssignMaterialToLayer”, but this breaks whatever other command is running so it does not work for me)

Hi @isak.wadso,

If you’re using Rhino 8, then you might look into the new Rhino Data types added to V8.

Otherwise, you might review this thread and see if you can gleam anything useful.

– Dale

Hi Dale,
Thanks for the reference. I adapted it to my case, and by setting the layer’s attributes directly with python, it works :slight_smile:

I attach the grasshopper snippet if someone has the same problem later.
Change the render material of a (7.3 KB)