mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
type.assign_type - support batching #4474
This commit is contained in:
@@ -210,7 +210,7 @@ class TestCopyClass(test.bootstrap.IFC4):
|
||||
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)
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_objects=[element], relating_type=type)
|
||||
new = ifcopenshell.api.run("root.copy_class", self.file, product=type)
|
||||
assert not new.Types
|
||||
|
||||
|
||||
@@ -54,9 +54,9 @@ class TestReassignClass(test.bootstrap.IFC4):
|
||||
def test_reassign_class_for_type_occurrences(self):
|
||||
element_type = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWallType")
|
||||
element1 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_object=element1, relating_type=element_type)
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_objects=[element1], relating_type=element_type)
|
||||
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_object=element2, relating_type=element_type)
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_objects=[element2], relating_type=element_type)
|
||||
|
||||
element_type = ifcopenshell.api.run(
|
||||
"root.reassign_class", self.file, product=element_type, ifc_class="IfcSlabType"
|
||||
@@ -74,9 +74,9 @@ class TestReassignClass(test.bootstrap.IFC4):
|
||||
def test_reassigning_type_class_and_its_occurrences_classes_if_entity_was_typed(self):
|
||||
element_type = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWallType")
|
||||
element1 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_object=element1, relating_type=element_type)
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_objects=[element1], relating_type=element_type)
|
||||
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_object=element2, relating_type=element_type)
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_objects=[element2], relating_type=element_type)
|
||||
|
||||
element1 = ifcopenshell.api.run("root.reassign_class", self.file, product=element1, ifc_class="IfcSlab")
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ class TestRemoveProduct(test.bootstrap.IFC4):
|
||||
context = ifcopenshell.api.run("context.add_context", self.file, context_type="Model")
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
element_type = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWallType")
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_object=element, relating_type=element_type)
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_objects=[element], relating_type=element_type)
|
||||
rep_map = self.file.createIfcRepresentationMap(
|
||||
MappingOrigin=self.file.createIfcAxis2Placement3D(),
|
||||
MappedRepresentation=self.file.createIfcShapeRepresentation(
|
||||
@@ -377,7 +377,7 @@ class TestRemoveProduct(test.bootstrap.IFC4):
|
||||
def test_removing_all_type_relationships_of_an_element(self):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
element_type = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWallType")
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_object=element, relating_type=element_type)
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_objects=[element], relating_type=element_type)
|
||||
ifcopenshell.api.run("root.remove_product", self.file, product=element)
|
||||
assert not self.file.by_type("IfcRelDefinesByType")
|
||||
assert self.file.by_type("IfcWallType")
|
||||
@@ -386,8 +386,8 @@ class TestRemoveProduct(test.bootstrap.IFC4):
|
||||
element1 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
element_type = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWallType")
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_object=element1, relating_type=element_type)
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_object=element2, relating_type=element_type)
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_objects=[element1], relating_type=element_type)
|
||||
ifcopenshell.api.run("type.assign_type", self.file, related_objects=[element2], relating_type=element_type)
|
||||
ifcopenshell.api.run("root.remove_product", self.file, product=element_type)
|
||||
assert not self.file.by_type("IfcRelDefinesByType")
|
||||
assert self.file.by_type("IfcWall")
|
||||
|
||||
Reference in New Issue
Block a user