ifcopenshell.api.sequence.add_time_period#

Module Contents#

class ifcopenshell.api.sequence.add_time_period.Usecase(file, recurrence_pattern=None, start_time=None, end_time=None)#

Adds a time period to a recurrence pattern

A recurring time may be an all-day event, or only during certain time periods of the day. For example, you might say that every 1st of January recurring is a public holiday, which is an all-day event. Alternatively, you might say that you work every (i.e. recurringly) Monday to Friday, from 9am to 5pm. The 9am to 5pm is the time period.

There may also be multiple recurrence patterns, such as from 9am to 12pm, and then another from 1pm to 5pm (to indicate an hour break for lunch).

Parameters
  • recurrence_pattern (ifcopenshell.entity_instance.entity_instance) – The IfcRecurrencePattern to add the time period to. See ifcopenshell.api.sequence.assign_recurrence_pattern.

  • start_time (str,datetime.time) – The start time of the time period, in a format compatible with IfcTime, such as an ISO format time string or a datetime.time object.

  • end_time (str,datetime.time) – The end time of the time period, in a format compatible with IfcTime, such as an ISO format time string or a datetime.time object.

Returns

The newly created IfcTimePeriod

Return type

ifcopenshell.entity_instance.entity_instance

Example:

# 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")

# We create a weekly recurrence
pattern = ifcopenshell.api.run("sequence.assign_recurrence_pattern", model,
    parent=work_time, recurrence_type="WEEKLY")

# State that we work from weekdays 1 to 5 (i.e. Monday to Friday)
ifcopenshell.api.run("sequence.edit_recurrence_pattern", model,
    recurrence_pattern=pattern, attributes={"WeekdayComponent": [1, 2, 3, 4, 5]})

# The morning work session, lunch, then the afternoon work session.
ifcopenshell.api.run("sequence.add_time_period", model,
    recurrence_pattern=pattern, start_time="09:00", end_time="12:00")
ifcopenshell.api.run("sequence.add_time_period", model,
    recurrence_pattern=pattern, start_time="13:00", end_time="17:00")
execute(self)#