Fix #1931. Fix bug where duplicated type products should not share material associations.

This commit is contained in:
Dion Moult
2022-01-14 13:15:47 +11:00
parent 5a87ab8171
commit ec38fe2edc
2 changed files with 12 additions and 0 deletions
@@ -117,6 +117,14 @@ class TestCopyClass(test.bootstrap.IFC4):
assert new.HasAssociations[0].RelatingMaterial != element.HasAssociations[0].RelatingMaterial
assert new.HasAssociations[0].RelatingMaterial.is_a("IfcMaterialLayerSetUsage")
def test_copying_material_sets_for_type_elements_only(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWallType")
material = self.file.createIfcMaterialLayerSet()
self.file.createIfcRelAssociatesMaterial(RelatedObjects=[element], RelatingMaterial=material)
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("IfcMaterialLayerSet")
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")