type.assign_type - support batching #4474

This commit is contained in:
Andrej730
2024-04-10 17:18:37 +05:00
parent ba4eb2a891
commit df4943205a
34 changed files with 308 additions and 162 deletions
@@ -88,7 +88,7 @@ class TestAppendAsset(test.bootstrap.IFC4):
element = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWall")
element_type = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWallType")
element_type2 = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWallType")
ifcopenshell.api.run("type.assign_type", library, related_object=element, relating_type=element_type)
ifcopenshell.api.run("type.assign_type", library, related_objects=[element], relating_type=element_type)
material = ifcopenshell.api.run("material.add_material", library, name="Material")
ifcopenshell.api.run("material.assign_material", library, product=element, material=material)
ifcopenshell.api.run("material.assign_material", library, product=element_type, material=material)
@@ -186,7 +186,7 @@ class TestAppendAsset(test.bootstrap.IFC4):
element_type.RepresentationMaps = [library.createIfcRepresentationMap(MappedRepresentation=mapped_rep)]
element = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWall")
ifcopenshell.api.run("type.assign_type", library, related_object=element, relating_type=element_type)
ifcopenshell.api.run("type.assign_type", library, related_objects=[element], relating_type=element_type)
ifcopenshell.api.run("project.append_asset", self.file, library=library, element=element)
assert len(self.file.by_type("IfcStyledItem")) == 1
@@ -356,7 +356,7 @@ class TestAppendAsset(test.bootstrap.IFC4):
library = ifcopenshell.api.run("project.create_file")
element = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWall")
element_type = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWallType")
ifcopenshell.api.run("type.assign_type", library, related_object=element, relating_type=element_type)
ifcopenshell.api.run("type.assign_type", library, related_objects=[element], relating_type=element_type)
ifcopenshell.api.run("project.append_asset", self.file, library=library, element=element)
assert ifcopenshell.util.element.get_type(self.file.by_type("IfcWall")[0]).is_a("IfcWallType")
@@ -366,9 +366,9 @@ class TestAppendAsset(test.bootstrap.IFC4):
element2 = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWall")
element3 = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWall")
element_type = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWallType")
ifcopenshell.api.run("type.assign_type", library, related_object=element, relating_type=element_type)
ifcopenshell.api.run("type.assign_type", library, related_object=element2, relating_type=element_type)
ifcopenshell.api.run("type.assign_type", library, related_object=element3, relating_type=element_type)
ifcopenshell.api.run("type.assign_type", library, related_objects=[element], relating_type=element_type)
ifcopenshell.api.run("type.assign_type", library, related_objects=[element2], relating_type=element_type)
ifcopenshell.api.run("type.assign_type", library, related_objects=[element3], relating_type=element_type)
ifcopenshell.api.run("project.append_asset", self.file, library=library, element=element)
ifcopenshell.api.run("project.append_asset", self.file, library=library, element=element2)
assert len(ifcopenshell.util.element.get_types(self.file.by_type("IfcWallType")[0])) == 2
@@ -387,7 +387,7 @@ class TestAppendAsset(test.bootstrap.IFC4):
element = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWall")
element_type = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWallType")
element_type2 = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWallType")
ifcopenshell.api.run("type.assign_type", library, related_object=element, relating_type=element_type)
ifcopenshell.api.run("type.assign_type", library, related_objects=[element], relating_type=element_type)
material = ifcopenshell.api.run("material.add_material", library, name="Material")
ifcopenshell.api.run("material.assign_material", library, product=element, material=material)
ifcopenshell.api.run("material.assign_material", library, product=element_type, material=material)
@@ -419,7 +419,7 @@ class TestAppendAssetIFC2X3(test.bootstrap.IFC2X3):
library = ifcopenshell.api.run("project.create_file", version="IFC2X3")
element = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWall")
element_type = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWallType")
ifcopenshell.api.run("type.assign_type", library, related_object=element, relating_type=element_type)
ifcopenshell.api.run("type.assign_type", library, related_objects=[element], relating_type=element_type)
ifcopenshell.api.run("project.append_asset", self.file, library=library, element=element)
assert ifcopenshell.util.element.get_type(self.file.by_type("IfcWall")[0]).is_a("IfcWallType")
@@ -429,9 +429,9 @@ class TestAppendAssetIFC2X3(test.bootstrap.IFC2X3):
element2 = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWall")
element3 = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWall")
element_type = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcWallType")
ifcopenshell.api.run("type.assign_type", library, related_object=element, relating_type=element_type)
ifcopenshell.api.run("type.assign_type", library, related_object=element2, relating_type=element_type)
ifcopenshell.api.run("type.assign_type", library, related_object=element3, relating_type=element_type)
ifcopenshell.api.run("type.assign_type", library, related_objects=[element], relating_type=element_type)
ifcopenshell.api.run("type.assign_type", library, related_objects=[element2], relating_type=element_type)
ifcopenshell.api.run("type.assign_type", library, related_objects=[element3], relating_type=element_type)
ifcopenshell.api.run("project.append_asset", self.file, library=library, element=element)
ifcopenshell.api.run("project.append_asset", self.file, library=library, element=element2)
assert len(ifcopenshell.util.element.get_types(self.file.by_type("IfcWallType")[0])) == 2