Guard get_style() against non-IfcMaterial material sets lacking HasRepresentation

This commit is contained in:
Richard Brice
2026-08-26 09:14:44 -07:00
parent 05ba93ab61
commit 3b908aff79
+4
View File
@@ -331,6 +331,10 @@ class Material(bonsai.core.tool.Material):
@classmethod
def get_style(cls, material: ifcopenshell.entity_instance) -> Union[ifcopenshell.entity_instance, None]:
if not material.is_a("IfcMaterial"):
# material may also be an IfcMaterialConstituentSet / IfcMaterialLayerSet /
# IfcMaterialProfileSet / IfcMaterialList, none of which have HasRepresentation.
return None
for material_representation in material.HasRepresentation:
for representation in material_representation.Representations:
for item in representation.Items: