mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 11:43:53 +00:00
sequence.copy_work_schedule #6901
Similar to e50215ddc but for IfcWorkSchedules
Button location - https://files.catbox.moe/jfd1ol.png
This commit is contained in:
@@ -46,6 +46,7 @@ classes = (
|
||||
operator.ContractTask,
|
||||
operator.CopyTask,
|
||||
operator.CopyTaskAttribute,
|
||||
operator.CopyWorkSchedule,
|
||||
operator.CreateBaseline,
|
||||
operator.DisableEditingSequence,
|
||||
operator.DisableEditingTask,
|
||||
|
||||
@@ -277,6 +277,20 @@ class RemoveWorkSchedule(bpy.types.Operator, tool.Ifc.Operator):
|
||||
core.remove_work_schedule(tool.Ifc, work_schedule=tool.Ifc.get().by_id(self.work_schedule))
|
||||
|
||||
|
||||
class CopyWorkSchedule(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_idname = "bim.copy_work_schedule"
|
||||
bl_label = "Copy Work Schedule"
|
||||
bl_description = "Create a duplicate of the provided work schedule."
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
work_schedule: bpy.props.IntProperty() # pyright: ignore[reportRedeclaration]
|
||||
|
||||
if TYPE_CHECKING:
|
||||
work_schedule: int
|
||||
|
||||
def _execute(self, context):
|
||||
core.copy_work_schedule(tool.Sequence, work_schedule=tool.Ifc.get().by_id(self.work_schedule))
|
||||
|
||||
|
||||
class EnableEditingWorkSchedule(bpy.types.Operator):
|
||||
bl_idname = "bim.enable_editing_work_schedule"
|
||||
bl_label = "Enable Editing Work Schedule"
|
||||
|
||||
@@ -246,6 +246,7 @@ class BIM_PT_work_schedules(Panel):
|
||||
row.operator("bim.enable_editing_work_schedule", text="", icon="GREASEPENCIL").work_schedule = (
|
||||
work_schedule_id
|
||||
)
|
||||
row.operator("bim.copy_work_schedule", text="", icon="DUPLICATE").work_schedule = work_schedule_id
|
||||
row.operator("bim.remove_work_schedule", text="", icon="X").work_schedule = work_schedule_id
|
||||
if self.props.active_work_schedule_id == work_schedule_id:
|
||||
if self.props.editing_type == "WORK_SCHEDULE":
|
||||
|
||||
@@ -71,6 +71,10 @@ def remove_work_schedule(ifc: type[tool.Ifc], work_schedule: ifcopenshell.entity
|
||||
ifc.run("sequence.remove_work_schedule", work_schedule=work_schedule)
|
||||
|
||||
|
||||
def copy_work_schedule(sequence: type[tool.Sequence], work_schedule: ifcopenshell.entity_instance) -> None:
|
||||
sequence.copy_work_schedule(work_schedule)
|
||||
|
||||
|
||||
def assign_work_schedule(
|
||||
ifc: type[tool.Ifc], work_plan: ifcopenshell.entity_instance, work_schedule: ifcopenshell.entity_instance
|
||||
) -> Union[ifcopenshell.entity_instance, None]:
|
||||
|
||||
@@ -22,6 +22,7 @@ import re
|
||||
import bpy
|
||||
import json
|
||||
import base64
|
||||
import ifcopenshell.api.sequence
|
||||
import pystache
|
||||
import mathutils
|
||||
import webbrowser
|
||||
@@ -1846,3 +1847,9 @@ class Sequence(bonsai.core.tool.Sequence):
|
||||
if not element or not element.is_a("IfcProduct"):
|
||||
continue
|
||||
obj.hide_set(element not in visible_elements)
|
||||
|
||||
@classmethod
|
||||
def copy_work_schedule(cls, work_schedule: ifcopenshell.entity_instance) -> None:
|
||||
ifc_file = tool.Ifc.get()
|
||||
new_schedule = ifcopenshell.api.sequence.copy_work_schedule(ifc_file, work_schedule)
|
||||
new_schedule.Name = (new_schedule.Name or "Unnamed") + " Copy"
|
||||
|
||||
Reference in New Issue
Block a user