mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Fix bug where copying a type also copied its type relations which is invalid.
This commit is contained in:
@@ -31,6 +31,8 @@ class Usecase:
|
||||
continue
|
||||
elif inverse.is_a("IfcRelContainedInSpatialStructure") and inverse.RelatingStructure == from_element:
|
||||
continue
|
||||
elif inverse.is_a("IfcRelDefinesByType") and inverse.RelatingType == from_element:
|
||||
continue
|
||||
elif inverse.is_a("IfcRelFillsElement"):
|
||||
continue
|
||||
elif inverse.is_a("IfcRelAssociatesMaterial") and "Usage" in inverse.RelatingMaterial.is_a():
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user