Change object material to a rendermaterial

Is there a way to assign object material via the RhinoCommon SDK?
No materials are assigned, so RhinoDoc.ActiveDoc.Materials is empty
There are materials stored in the document so RhinoDoc.ActiveDoc.RenderMaterials has items
I’ve done the obj.Attributes.MaterialSource = ObjectMaterialSource.MaterialFromObject
How do I assign a material to that object?

Hi @Will_Wang ,

Review the comments in this sample and let me know if you have any questions.


– Dale

1 Like

Thanks Dale
I’m looking for ways to do this, if there is any

I could create another material and mirror the rendermaterial properties I want to assign to objects. But doing so seems to add a duplicate to material panel.

So i have “glass 1” and “glass 2” in the material panel (GUI). If i create a material and call it glass 1 and mirror some properties of the “glass 1” rendermaterial, my material panel will show two “glass 1”.

this should do it

1 Like