mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +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
|
@classmethod
|
||||||
def get_style(cls, material: ifcopenshell.entity_instance) -> Union[ifcopenshell.entity_instance, None]:
|
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 material_representation in material.HasRepresentation:
|
||||||
for representation in material_representation.Representations:
|
for representation in material_representation.Representations:
|
||||||
for item in representation.Items:
|
for item in representation.Items:
|
||||||
|
|||||||
Reference in New Issue
Block a user