mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-28 07:49:59 +00:00
Guard get_style() against non-IfcMaterial material sets lacking HasRepresentation
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user