mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
Replace all ifcopenshell.api.run with ifcopenshell.api static functions.
This commit is contained in:
@@ -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})
|
||||
|
||||
Reference in New Issue
Block a user