How to get GroundPlane material?


C# RhinoCommon. Calling Rhino.RhinoDoc.ActiveDoc.Materials.Find(Rhino.RhinoDoc.ActiveDoc.GroundPlane.MaterialInstanceId, true) seems to always return -1, even when there is a specific material assigned in the Ground Plane panel. Is this a bug, or am I trying to access the material is the wrong fashion?



The ground plane material is a V5 style material. Unfortunately ( calling @stevebaer ) it looks like this is all in the “RDK_UNCHECKED” section too.

Guid id = doc.GroundPlane.MaterialInstanceId;

    Rhino.Render.RenderContent gpm = Rhino.Render.Utilities.MaterialList(doc).FindInstance(id);

I can see why - ideally this would all be integrated into the doc (as it will be in V6)

I think we’ve got this handled for SR7 now. There will be a RenderMaterial table on the RhinoDoc

Note that there will also be this method in SR7:

System.Guid id = doc.GroundPlane.MaterialInstanceId;

Rhino.Render.RenderMaterial material = Rhino.Render.RenderMaterial.FromId(doc, id);