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
@@ -17,31 +17,28 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
class Usecase:
def __init__(self, file, work_time=None):
"""Removes a work time
def remove_work_time(file, work_time=None) -> None:
"""Removes a work time
:param work_time: The IfcWorkTime to remove.
:type work_time: ifcopenshell.entity_instance
:return: None
:rtype: None
:param work_time: The IfcWorkTime to remove.
:type work_time: ifcopenshell.entity_instance
:return: None
:rtype: None
Example:
Example:
.. code:: python
.. code:: python
# Let's create a new calendar.
calendar = ifcopenshell.api.run("sequence.add_work_calendar", model)
# Let's create a new calendar.
calendar = ifcopenshell.api.run("sequence.add_work_calendar", model)
# Let's start defining the times that we work during the week.
work_time = ifcopenshell.api.run("sequence.add_work_time", model,
work_calendar=calendar, time_type="WorkingTimes")
# Let's start defining the times that we work during the week.
work_time = ifcopenshell.api.run("sequence.add_work_time", model,
work_calendar=calendar, time_type="WorkingTimes")
# And remove it immediately
ifcopenshell.api.run("sequence.remove_work_time", model, work_time=work_time)
"""
self.file = file
self.settings = {"work_time": work_time}
# And remove it immediately
ifcopenshell.api.run("sequence.remove_work_time", model, work_time=work_time)
"""
settings = {"work_time": work_time}
def execute(self):
self.file.remove(self.settings["work_time"])
file.remove(settings["work_time"])