Accesing Render Material color from GH

Hi, i’am trying to access to render materials difuse color from GH but I cant figure out how to do this. My render material aren’t expected to be assigned to any document object at the moment of accesing to their diffuse color. I want to associate my GH geometry to a render material, so this material will be used later when user decide to bake the GH geometry to the document. So far I can:

names = []
matId = []
colors = []
for mat in Rhino.RhinoDoc.ActiveDoc.RenderMaterials:
    names.append( mat.Name)
    materials.append(str(mat.Id))
    #dont know how to acces to render material color!!

RenderMaterial.SimulateMaterial - then access the diffuse from there.

Remember, that for some material definitions, diffuse is not a valid concept - metal, for example, or glass. You may get results you don’t expect.

1 Like
import Rhino
names = []
colors = []
for mat in Rhino.RhinoDoc.ActiveDoc.RenderMaterials:
    names.append(mat.Name)
    colors.append(mat.SimulateMaterial(True).DiffuseColor)
a = names
b = colors
1 Like