Grasshopper

algorithmic modeling for Rhino

Hi Folks!

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[0];

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
Thomas.

Views: 180

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service