mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-17 02:49:12 +00:00
Replace all ifcopenshell.api.run with ifcopenshell.api static functions.
This commit is contained in:
@@ -37,32 +37,32 @@ def disconnect_port(file: ifcopenshell.file, port: ifcopenshell.entity_instance)
|
||||
.. code:: python
|
||||
|
||||
# A completely empty distribution system
|
||||
system = ifcopenshell.api.run("system.add_system", model)
|
||||
system = ifcopenshell.api.system.add_system(model)
|
||||
|
||||
# Create a duct and a 90 degree bend fitting
|
||||
duct = ifcopenshell.api.run("root.create_entity", model,
|
||||
duct = ifcopenshell.api.root.create_entity(model,
|
||||
ifc_class="IfcDuctSegment", predefined_type="RIGIDSEGMENT")
|
||||
fitting = ifcopenshell.api.run("root.create_entity", model,
|
||||
fitting = ifcopenshell.api.root.create_entity(model,
|
||||
ifc_class="IfcDuctFitting", predefined_type="BEND")
|
||||
|
||||
# The duct and fitting is part of the system
|
||||
ifcopenshell.api.run("system.assign_system", model, products=[duct], system=system)
|
||||
ifcopenshell.api.run("system.assign_system", model, products=[fitting], system=system)
|
||||
ifcopenshell.api.system.assign_system(model, products=[duct], system=system)
|
||||
ifcopenshell.api.system.assign_system(model, products=[fitting], system=system)
|
||||
|
||||
# Create 2 ports, one for either end of both the duct and fitting.
|
||||
duct_port1 = ifcopenshell.api.run("system.add_port", model, element=duct)
|
||||
duct_port2 = ifcopenshell.api.run("system.add_port", model, element=duct)
|
||||
fitting_port1 = ifcopenshell.api.run("system.add_port", model, element=fitting)
|
||||
fitting_port2 = ifcopenshell.api.run("system.add_port", model, element=fitting)
|
||||
duct_port1 = ifcopenshell.api.system.add_port(model, element=duct)
|
||||
duct_port2 = ifcopenshell.api.system.add_port(model, element=duct)
|
||||
fitting_port1 = ifcopenshell.api.system.add_port(model, element=fitting)
|
||||
fitting_port2 = ifcopenshell.api.system.add_port(model, element=fitting)
|
||||
|
||||
# Connect the duct and fitting together. At this point, we have not
|
||||
# yet determined the direction of the flow, so we leave direction as
|
||||
# NOTDEFINED.
|
||||
ifcopenshell.api.run("system.connect_port", model, port1=duct_port2, port2=fitting_port1)
|
||||
ifcopenshell.api.system.connect_port(model, port1=duct_port2, port2=fitting_port1)
|
||||
|
||||
# Disconnect the port. note we could've equally disconnected
|
||||
# fitting_port1 instead of duct_port2
|
||||
ifcopenshell.api.run("system.disconnect_port", model, port=duct_port2)
|
||||
ifcopenshell.api.system.disconnect_port(model, port=duct_port2)
|
||||
"""
|
||||
settings = {
|
||||
"port": port,
|
||||
|
||||
Reference in New Issue
Block a user