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.group
import ifcopenshell.util.system
@@ -43,14 +43,14 @@ def assign_system(
.. 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
duct = ifcopenshell.api.run("root.create_entity", model,
duct = ifcopenshell.api.root.create_entity(model,
ifc_class="IfcDuctSegment", predefined_type="RIGIDSEGMENT")
# This duct is part of the system
ifcopenshell.api.run("system.assign_system", model, products=[duct], system=system)
ifcopenshell.api.system.assign_system(model, products=[duct], system=system)
"""
settings = {
"products": products,
@@ -63,5 +63,4 @@ def assign_system(
if not all(ifcopenshell.util.system.is_assignable(failed_product := product, system) for product in products):
raise TypeError(f"You cannot assign an {failed_product.is_a()} to an {system.is_a()}")
rel = ifcopenshell.api.run("group.assign_group", file, products=products, group=system)
return rel
return ifcopenshell.api.group.assign_group(file, products=products, group=system)