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
@@ -48,17 +48,17 @@ def create_axis_curve(
.. code:: python
# A pretty standard rectangular grid, with only two axes.
grid = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcGrid")
axis_a = ifcopenshell.api.run("grid.create_grid_axis", model,
grid = ifcopenshell.api.root.create_entity(model, ifc_class="IfcGrid")
axis_a = ifcopenshell.api.grid.create_grid_axis(model,
axis_tag="A", uvw_axes="UAxes", grid=grid)
axis_1 = ifcopenshell.api.run("grid.create_grid_axis", model,
axis_1 = ifcopenshell.api.grid.create_grid_axis(model,
axis_tag="1", uvw_axes="VAxes", grid=grid)
# Assume you have these Blender objects in your active Blender session
obj1 = bpy.data.objects.get("AxisA")
obj2 = bpy.data.objects.get("Axis1")
ifcopenshell.api.run("grid.create_axis_curve", model, axis_curve=obj1, grid_axis=axis_a)
ifcopenshell.api.run("grid.create_axis_curve", model, axis_curve=obj2, grid_axis=axis_1)
ifcopenshell.api.grid.create_axis_curve(model, axis_curve=obj1, grid_axis=axis_a)
ifcopenshell.api.grid.create_axis_curve(model, axis_curve=obj2, grid_axis=axis_1)
"""
usecase = Usecase()
usecase.file = file
@@ -68,10 +68,10 @@ def create_grid_axis(
Example:
# A pretty standard rectangular grid, with only two axes.
grid = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcGrid")
axis_a = ifcopenshell.api.run("grid.create_grid_axis", model,
grid = ifcopenshell.api.root.create_entity(model, ifc_class="IfcGrid")
axis_a = ifcopenshell.api.grid.create_grid_axis(model,
axis_tag="A", uvw_axes="UAxes", grid=grid)
axis_1 = ifcopenshell.api.run("grid.create_grid_axis", model,
axis_1 = ifcopenshell.api.grid.create_grid_axis(model,
axis_tag="1", uvw_axes="VAxes", grid=grid)
"""
@@ -30,18 +30,18 @@ def remove_grid_axis(file: ifcopenshell.file, axis: ifcopenshell.entity_instance
Example:
# A pretty standard rectangular grid, with only two axes.
grid = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcGrid")
axis_a = ifcopenshell.api.run("grid.create_grid_axis", model,
grid = ifcopenshell.api.root.create_entity(model, ifc_class="IfcGrid")
axis_a = ifcopenshell.api.grid.create_grid_axis(model,
axis_tag="A", uvw_axes="UAxes", grid=grid)
axis_1 = ifcopenshell.api.run("grid.create_grid_axis", model,
axis_1 = ifcopenshell.api.grid.create_grid_axis(model,
axis_tag="1", uvw_axes="VAxes", grid=grid)
# Let's create a third so we can remove it later
axis_2 = ifcopenshell.api.run("grid.create_grid_axis", model,
axis_2 = ifcopenshell.api.grid.create_grid_axis(model,
axis_tag="2", uvw_axes="VAxes", grid=grid)
# Let's remove it!
ifcopenshell.api.run("grid.remove_grid_axis", model, axis=axis_2)
ifcopenshell.api.grid.remove_grid_axis(model, axis=axis_2)
"""
axis_curve = axis.AxisCurve
if len(file.get_inverse(axis_curve)) == 1: