root.copy_class to support copying ports in ifc2x3

This commit is contained in:
Andrej730
2023-07-14 15:47:36 +05:00
parent 6c88d55cb8
commit 38dd5a218c
2 changed files with 44 additions and 16 deletions
@@ -232,3 +232,15 @@ class TestCopyClass(test.bootstrap.IFC4):
new = ifcopenshell.api.run("root.copy_class", self.file, product=element)
assert len(self.file.by_type("IfcRelAssignsToGroup")) == 1
assert new.HasAssignments[0].RelatingGroup == group
class TestCopyClassIFC2X3(test.bootstrap.IFC2X3):
def test_copying_distribution_ports_bug(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowTerminal")
port = ifcopenshell.api.run("system.add_port", self.file)
ifcopenshell.api.run("system.assign_port", self.file, element=element, port=port)
new = ifcopenshell.api.run("root.copy_class", self.file, product=element)
new_ports = ifcopenshell.util.system.get_ports(new)
assert port not in new_ports
assert new_ports[0].is_a("IfcDistributionPort")
assert ifcopenshell.util.system.get_ports(element) == [port]