get_element_by_style to support IfcFillAreaStyleTiles

This commit is contained in:
Andrej730
2024-10-01 14:50:08 +05:00
parent e040dc4562
commit 4b39631b98
2 changed files with 38 additions and 11 deletions
@@ -652,6 +652,29 @@ class TestGetElementsByStyle(test.bootstrap.IFC4):
)
assert subject.get_elements_by_style(self.file, curve_style) == {element}
def test_getting_elements_of_a_styled_material_with_fill_area_style_tiles(self):
# NOTE: Not sure if this the exactly correct way to implement IfcFillAreaStyleTiles
# couldn't find any .ifc files implementing it, so taking my best guess.
# Ref: https://web.archive.org/web/20220711062839/https://ifcdoctor.com/2022/07/11/graphics-in-ifc/
element = self.file.create_entity("IfcWall")
material = ifcopenshell.api.material.add_material(self.file)
ifcopenshell.api.material.assign_material(self.file, products=[element], material=material)
tile_style = self.file.create_entity("IfcCurveStyle")
tile_curve = self.file.create_entity("IfcGeometricSet")
styled_item = self.file.create_entity("IfcStyledItem", Styles=[tile_style], Item=tile_curve)
fill_style = self.file.create_entity("IfcFillAreaStyleTiles", Tiles=[styled_item])
style = self.file.create_entity("IfcFillAreaStyle", FillStyles=[fill_style])
self.file.create_entity(
"IfcMaterialDefinitionRepresentation",
RepresentedMaterial=material,
Representations=[
self.file.create_entity(
"IfcStyledRepresentation", Items=[self.file.create_entity("IfcStyledItem", Styles=[style])]
)
],
)
assert subject.get_elements_by_style(self.file, tile_style) == {element}
class TestGetElementsByRepresentation(test.bootstrap.IFC4):
def test_getting_elements_of_a_styled_representation_item(self):