I’m working on a UI for assigning materials to surfaces. I specifically want to assign to polysurface faces. The UI has an alpha list of materials in the file and an “assign” button which prompts for a selected surface sub-object.
The below script is supposed to assign the named material to the surface, but its assigning another material instead. Can anyone tell me what I’m doing wrong here?
doc_materials = Rhino.RhinoDoc.ActiveDoc.Materials
for i in range(doc_materials.Count):
if doc_materials[i].Name == str(self.selected_material):
brep = rs.coercebrep(self.brep_id)
if brep:
the_face = brep.Faces[self.selected_face_index.Index]
brep.Faces[self.selected_face_index.Index].MaterialChannelIndex = i
break
1 post - 1 participant