Support other voiding IfcFeatureElementSubtraction elements #3889

Support other voiding IfcFeatureElementSubtraction besides IfcOpeningElement.
This commit is contained in:
Andrej730
2023-10-16 15:05:40 +05:00
parent ce8598a0b4
commit 24eb149221
4 changed files with 16 additions and 4 deletions
@@ -120,6 +120,7 @@ class TestCopyClass(test.bootstrap.IFC4):
assert new.RepresentationMaps is None
def test_copying_an_element_with_an_opening(self):
# IfcOpeningElement opening
wall = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
opening = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcOpeningElement")
ifcopenshell.api.run("void.add_opening", self.file, opening=opening, element=wall)
@@ -129,6 +130,16 @@ class TestCopyClass(test.bootstrap.IFC4):
assert new.HasOpenings[0].RelatedOpeningElement != opening
assert new.HasOpenings[0].RelatedOpeningElement.is_a("IfcOpeningElement")
# IfcVoidingFeature opening
plate = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPlate")
opening = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcVoidingFeature")
ifcopenshell.api.run("void.add_opening", self.file, opening=opening, element=plate)
new = ifcopenshell.api.run("root.copy_class", self.file, product=plate)
assert plate.HasOpenings[0] != new.HasOpenings[0]
assert plate.HasOpenings[0].RelatedOpeningElement == opening
assert new.HasOpenings[0].RelatedOpeningElement != opening
assert new.HasOpenings[0].RelatedOpeningElement.is_a("IfcVoidingFeature")
def test_copying_an_element_with_a_filled_opening_should_not_copy_the_opening_nor_fill(self):
wall = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
opening = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcOpeningElement")