mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
Generate functions for all API usecases for better static code features. See #2693.
This commit is contained in:
@@ -17,40 +17,37 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
class Usecase:
|
||||
def __init__(self, file, recurrence_pattern=None):
|
||||
"""Unassigns a recurrence pattern
|
||||
def unassign_recurrence_pattern(file, recurrence_pattern=None) -> None:
|
||||
"""Unassigns a recurrence pattern
|
||||
|
||||
Note that a recurring task time must have a recurrence pattern, so if
|
||||
you remove it, be sure to clean up after yourself.
|
||||
Note that a recurring task time must have a recurrence pattern, so if
|
||||
you remove it, be sure to clean up after your
|
||||
|
||||
:param recurrence_pattern: The IfcRecurrencePattern to remove.
|
||||
:type recurrence_pattern: ifcopenshell.entity_instance
|
||||
:return: None
|
||||
:rtype: None
|
||||
:param recurrence_pattern: The IfcRecurrencePattern to remove.
|
||||
:type recurrence_pattern: 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")
|
||||
|
||||
# We create a weekly recurrence
|
||||
pattern = ifcopenshell.api.run("sequence.assign_recurrence_pattern", model,
|
||||
parent=work_time, recurrence_type="WEEKLY")
|
||||
# We create a weekly recurrence
|
||||
pattern = ifcopenshell.api.run("sequence.assign_recurrence_pattern", model,
|
||||
parent=work_time, recurrence_type="WEEKLY")
|
||||
|
||||
# Change our mind, let's just maintain it whenever we feel like it.
|
||||
ifcopenshell.api.run("sequence.unassign_recurrence_pattern", recurrence_pattern=pattern)
|
||||
"""
|
||||
self.file = file
|
||||
self.settings = {"recurrence_pattern": recurrence_pattern}
|
||||
# Change our mind, let's just maintain it whenever we feel like it.
|
||||
ifcopenshell.api.run("sequence.unassign_recurrence_pattern", recurrence_pattern=pattern)
|
||||
"""
|
||||
settings = {"recurrence_pattern": recurrence_pattern}
|
||||
|
||||
def execute(self):
|
||||
for time_period in self.settings["recurrence_pattern"].TimePeriods or []:
|
||||
self.file.remove(time_period)
|
||||
self.file.remove(self.settings["recurrence_pattern"])
|
||||
for time_period in settings["recurrence_pattern"].TimePeriods or []:
|
||||
file.remove(time_period)
|
||||
file.remove(settings["recurrence_pattern"])
|
||||
|
||||
Reference in New Issue
Block a user