Hello
I want to convert from Revit to USD and then freely change the material using “MaterialBindingAPI” by Revit category or family.
I’m not mapping all materials in Revit and coming over to USD, but I’m in a situation where I want to do various things with scripts on USD.
If the prim path is /World/(Revit filename)/Geometry/Pipe_Fittings/…/…, when I apply MaterialBindingAPI by grouping Pipe_Fitting and traversing the component elements below, the conversion does not work. It seems to be an issue with Instance Proxies.
What methods are needed to easily handle objects that come from Revit with scripts?
Example source code:
group_path : /World/(Revit filename)/Geometry/Pipe_Fittings
material_path : /World/Looks/Aluminum_Sheet_Glossy_Streaks
def apply_material(self, group_path, material_path):
stage = omni.usd.get_context().get_stage()
material = UsdShade.Material(stage.GetPrimAtPath(material_path))
group_prim = stage.GetPrimAtPath(group_path)
for prim in Usd.PrimRange(group_prim):
if UsdGeom.Xform(prim) and not prim.IsA(UsdGeom.Scope):
UsdShade.MaterialBindingAPI(prim).Bind(material)