Fix bug where copying a type also copied its type relations which is invalid.

This commit is contained in:
Dion Moult
2021-10-26 20:51:27 +11:00
parent ee308d294f
commit 3406c23f98
8 changed files with 66 additions and 30 deletions
@@ -116,3 +116,10 @@ class TestCopyClass(test.bootstrap.IFC4):
new = ifcopenshell.api.run("root.copy_class", self.file, product=element)
assert new.HasAssociations[0].RelatingMaterial != element.HasAssociations[0].RelatingMaterial
assert new.HasAssociations[0].RelatingMaterial.is_a("IfcMaterialLayerSetUsage")
def test_copying_a_type_and_purging_type_relationships(self):
type = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWallType")
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
ifcopenshell.api.run("type.assign_type", self.file, related_object=element, relating_type=type)
new = ifcopenshell.api.run("root.copy_class", self.file, product=type)
assert not new.Types