ifcopenshell.api.sequence.duplicate_task

Module Contents

class ifcopenshell.api.sequence.duplicate_task.Usecase
copy_indirect_attributes(from_element: ifcopenshell.entity_instance, to_element: ifcopenshell.entity_instance) None
copy_sequence_relationship() None
create_object_reference(relating_object: ifcopenshell.entity_instance, related_object: ifcopenshell.entity_instance) ifcopenshell.entity_instance
duplicate_task(task: ifcopenshell.entity_instance) ifcopenshell.entity_instance
execute(task: ifcopenshell.entity_instance) tuple[list[ifcopenshell.entity_instance], list[ifcopenshell.entity_instance]]
current: list[ifcopenshell.entity_instance]
duplicate: list[ifcopenshell.entity_instance]
file: ifcopenshell.file
ifcopenshell.api.sequence.duplicate_task.duplicate_task(file: ifcopenshell.file, task: ifcopenshell.entity_instance) tuple[list[ifcopenshell.entity_instance], list[ifcopenshell.entity_instance]]

Duplicates a task in the project

The following relationships are also duplicated:

  • The copy will have the same attributes and property sets as the original task

  • The copy will be assigned to the parent task or work schedule

  • The copy will have duplicated nested tasks

Parameters:

task – The task to be duplicated

Returns:

A tuple that consists of two lists of tasks:

  • Original task and it’s nested tasks.

  • Their corresponding duplicated tasks.

Example: .. code:: python

# We have a task original_task = ifcopenshell.api.sequence.add_task(

model, work_schedule=work_schedule, name=”Design new feature”,

)

# And now we have two original_tasks, duplicated_tasks = ifcopenshell.api.sequence.duplicate_task(original_task) print(duplicated_tasks[0]) # A copy of original_task.