Fix #2285. You can now get all the elements in a presentation layer.

This commit is contained in:
Dion Moult
2023-01-12 12:28:09 +11:00
parent d1a40d129f
commit ba7741fef5
5 changed files with 183 additions and 31 deletions
@@ -441,9 +441,7 @@ class TestGetElementsByRepresentation(test.bootstrap.IFC4):
self.file.createIfcShapeRepresentation(
Items=[
self.file.createIfcMappedItem(
MappingSource=self.file.createIfcRepresentationMap(
MappedRepresentation=representation
)
MappingSource=self.file.createIfcRepresentationMap(MappedRepresentation=representation)
)
]
)
@@ -458,6 +456,16 @@ class TestGetElementsByRepresentation(test.bootstrap.IFC4):
assert subject.get_elements_by_representation(self.file, representation) == {element}
class TestGetElementsByLayer(test.bootstrap.IFC4):
def test_getting_the_elements_of_a_layer(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
layer = ifcopenshell.api.run("layer.add_layer", self.file)
representation = self.file.createIfcShapeRepresentation()
element.Representation = self.file.createIfcProductDefinitionShape(Representations=[representation])
ifcopenshell.api.run("layer.assign_layer", self.file, item=representation, layer=layer)
assert list(subject.get_elements_by_layer(self.file, layer)) == [element]
class TestGetlayers(test.bootstrap.IFC4):
def test_getting_the_layer_of_a_product_representation(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")