Replace all ifcopenshell.api.run with ifcopenshell.api static functions.

This commit is contained in:
Dion Moult
2024-06-28 12:36:31 +10:00
parent b5d613989e
commit 07060fc769
432 changed files with 4633 additions and 4856 deletions
@@ -17,7 +17,7 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.owner
import ifcopenshell.util.element
@@ -40,19 +40,19 @@ def unassign_actor(
.. code:: python
# We need to procure and install 2 of this particular pump type in our facility.
pump_type = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcPumpType")
pump_type = ifcopenshell.api.root.create_entity(model, ifc_class="IfcPumpType")
# Define who the manufacturer is
manufacturer = ifcopenshell.api.run("owner.add_organisation", model,
manufacturer = ifcopenshell.api.owner.add_organisation(model,
identification="PWP", name="Pumps With Power")
ifcopenshell.api.run("owner.add_role", model, assigned_object=manufacturer, role="MANUFACTURER")
ifcopenshell.api.owner.add_role(model, assigned_object=manufacturer, role="MANUFACTURER")
# Make the manufacturer responsible for that pump type.
ifcopenshell.api.run("owner.assign_actor", model,
ifcopenshell.api.owner.assign_actor(model,
relating_actor=manufacturer, related_object=pump_type)
# Undo the assignment
ifcopenshell.api.run("owner.unassign_actor", model,
ifcopenshell.api.owner.unassign_actor(model,
relating_actor=manufacturer, related_object=pump_type)
"""
settings = {
@@ -72,4 +72,4 @@ def unassign_actor(
related_objects = list(rel.RelatedObjects)
related_objects.remove(settings["related_object"])
rel.RelatedObjects = related_objects
ifcopenshell.api.run("owner.update_owner_history", file, **{"element": rel})
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})