Generate functions for all API usecases for better static code features. See #2693.

This commit is contained in:
Dion Moult
2024-05-06 14:35:39 +10:00
parent 10f894e2ea
commit d11ec67129
330 changed files with 13283 additions and 13751 deletions
@@ -19,35 +19,32 @@
import ifcopenshell.api
class Usecase:
def __init__(self, file, name=None, ifc_class="IfcStructuralLoadLinearForce"):
"""Adds a new structural load
def add_structural_load(file, name=None, ifc_class="IfcStructuralLoadLinearForce") -> None:
"""Adds a new structural load
Structural loads may be actions or reactions. A simple load might be a
static and be linear, planar, or a single point. Alternatively, loads
may be defined as a configuration of multiple loads.
Structural loads may be actions or reactions. A simple load might be a
static and be linear, planar, or a single point. Alternatively, loads
may be defined as a configuration of multiple loads.
:param name: The name of the load
:type name: str,optional
:param ifc_class: The subtype of IfcStructuralLoad to create. Consult
the IFC documentation to see all the types of loads.
:type ifc_class: str
:return: The newly created load entity, depending on the ifc_class
specified.
:rtype: ifcopenshell.entity_instance
:param name: The name of the load
:type name: str,optional
:param ifc_class: The subtype of IfcStructuralLoad to create. Consult
the IFC documentation to see all the types of loads.
:type ifc_class: str
:return: The newly created load entity, depending on the ifc_class
specified.
:rtype: ifcopenshell.entity_instance
Example:
Example:
.. code:: python
.. code:: python
# Create a simple linear load
ifcopenshell.api.run("structural.add_structural_load", model)
"""
self.file = file
self.settings = {
"name": name,
"ifc_class": ifc_class,
}
# Create a simple linear load
ifcopenshell.api.run("structural.add_structural_load", model)
"""
settings = {
"name": name,
"ifc_class": ifc_class,
}
def execute(self):
return self.file.create_entity(self.settings["ifc_class"], Name=self.settings["name"])
return file.create_entity(settings["ifc_class"], Name=settings["name"])