I have a problem dealing with render materials...In order to automatically apply different materials from an exisiting set, i want to transfer/copy them from already exisiting objects (respectively from doc.m_material_table-indecies) to those being generated.
This piece of c#-code was supposed to do the work:
IRhinoBrepObject obj = doc.AddBrepObject(g as OnBrep);
IRhinoMaterial mat = doc.m_material_table;
MRhinoObjectAttributes att = new MRhinoObjectAttributes(obj.Attributes());
att.m_material_index = doc.m_material_table.AddMaterial(mat);
doc.ModifyObjectAttributes(new MRhinoObjRef(obj.Attributes().m_uuid), att);
Unfortunately it doesn't. And I have no idea why. Can someone help me with this?
thx in advance