nest.assign_object - support batching #4474

This commit is contained in:
Andrej730
2024-04-09 16:41:34 +05:00
parent 064fc0e405
commit d270a4fef8
15 changed files with 173 additions and 45 deletions
@@ -42,8 +42,8 @@ class Usecase:
task = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcSite")
subtask1 = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcBuilding")
subtask2 = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcBuilding")
ifcopenshell.api.run("nest.assign_object", model, related_object=subtask1, relating_object=task)
ifcopenshell.api.run("nest.assign_object", model, related_object=subtask2, relating_object=task)
ifcopenshell.api.run("nest.assign_object", model, related_objects=[subtask1], relating_object=task)
ifcopenshell.api.run("nest.assign_object", model, related_objects=[subtask2], relating_object=task)
# The relationship is returned as task still has subtask2
rel = ifcopenshell.api.run("nest.unassign_object", model, related_object=subtask1)
# Nothing is returned, as the relationship has no related objects