From 01c1023af262ddecb820713263372d8ec0f9132a Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 8 Sep 2023 15:52:44 +1000 Subject: [PATCH] Fix bug when casting to tessellation for invalid IFCs which don't use material sets properly. --- src/blenderbim/blenderbim/bim/module/geometry/operator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/blenderbim/blenderbim/bim/module/geometry/operator.py b/src/blenderbim/blenderbim/bim/module/geometry/operator.py index 21e998bc67..d3ddc4222f 100644 --- a/src/blenderbim/blenderbim/bim/module/geometry/operator.py +++ b/src/blenderbim/blenderbim/bim/module/geometry/operator.py @@ -272,7 +272,8 @@ class UpdateRepresentation(bpy.types.Operator, Operator): if self.ifc_representation_class == "IfcTessellatedFaceSet": # We are explicitly casting to a tessellation, so remove all parametric materials. element_type = ifcopenshell.util.element.get_type(product) - ifcopenshell.api.run("material.unassign_material", tool.Ifc.get(), product=element_type) + if element_type: # Some invalid IFCs use material sets without a type. + ifcopenshell.api.run("material.unassign_material", tool.Ifc.get(), product=element_type) ifcopenshell.api.run("material.unassign_material", tool.Ifc.get(), product=product) else: # These objects are parametrically based on an axis and should not be modified as a mesh