mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-01 01:16:27 +00:00
You can now assign task successor and predecessors. Sweet. Thanks myoualid!
This commit is contained in:
@@ -32,6 +32,10 @@ classes = (
|
||||
operator.EnableEditingTask,
|
||||
operator.DisableEditingTask,
|
||||
operator.EditTask,
|
||||
operator.AssignPredecessor,
|
||||
operator.AssignSuccessor,
|
||||
operator.UnassignPredecessor,
|
||||
operator.UnassignSuccessor,
|
||||
prop.WorkPlan,
|
||||
prop.BIMWorkPlanProperties,
|
||||
prop.Task,
|
||||
|
||||
@@ -546,3 +546,75 @@ class EditTask(bpy.types.Operator):
|
||||
bpy.ops.bim.disable_editing_task()
|
||||
bpy.ops.bim.enable_editing_tasks(work_schedule=props.active_work_schedule_id)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class AssignPredecessor(bpy.types.Operator):
|
||||
bl_idname = "bim.assign_predecessor"
|
||||
bl_label = "Assign Predecessor"
|
||||
task: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
props = context.scene.BIMWorkScheduleProperties
|
||||
self.file = IfcStore.get_file()
|
||||
ifcopenshell.api.run(
|
||||
"sequence.assign_sequence",
|
||||
self.file,
|
||||
relating_process=IfcStore.get_file().by_id(self.task),
|
||||
related_process=IfcStore.get_file().by_id(props.active_task_id),
|
||||
)
|
||||
Data.load(self.file)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class AssignSuccessor(bpy.types.Operator):
|
||||
bl_idname = "bim.assign_successor"
|
||||
bl_label = "Assign Successor"
|
||||
task: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
props = context.scene.BIMWorkScheduleProperties
|
||||
self.file = IfcStore.get_file()
|
||||
ifcopenshell.api.run(
|
||||
"sequence.assign_sequence",
|
||||
self.file,
|
||||
relating_process=IfcStore.get_file().by_id(props.active_task_id),
|
||||
related_process=IfcStore.get_file().by_id(self.task),
|
||||
)
|
||||
Data.load(self.file)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class UnassignPredecessor(bpy.types.Operator):
|
||||
bl_idname = "bim.unassign_predecessor"
|
||||
bl_label = "Unassign Predecessor"
|
||||
task: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
props = context.scene.BIMWorkScheduleProperties
|
||||
self.file = IfcStore.get_file()
|
||||
ifcopenshell.api.run(
|
||||
"sequence.unassign_sequence",
|
||||
self.file,
|
||||
relating_process=IfcStore.get_file().by_id(self.task),
|
||||
related_process=IfcStore.get_file().by_id(props.active_task_id),
|
||||
)
|
||||
Data.load(self.file)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class UnassignSuccessor(bpy.types.Operator):
|
||||
bl_idname = "bim.unassign_successor"
|
||||
bl_label = "Unassign Successor"
|
||||
task: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
props = context.scene.BIMWorkScheduleProperties
|
||||
self.file = IfcStore.get_file()
|
||||
ifcopenshell.api.run(
|
||||
"sequence.unassign_sequence",
|
||||
self.file,
|
||||
relating_process=IfcStore.get_file().by_id(props.active_task_id),
|
||||
related_process=IfcStore.get_file().by_id(self.task),
|
||||
)
|
||||
Data.load(self.file)
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -153,6 +153,7 @@ class BIM_PT_work_schedules(Panel):
|
||||
class BIM_UL_tasks(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
||||
if item:
|
||||
props = context.scene.BIMWorkScheduleProperties
|
||||
row = layout.row(align=True)
|
||||
for i in range(0, item.level_index):
|
||||
row.label(text="", icon="BLANK1")
|
||||
@@ -169,10 +170,20 @@ class BIM_UL_tasks(UIList):
|
||||
row.label(text="", icon="DOT")
|
||||
row.prop(item, "identification", emboss=False, text="")
|
||||
row.prop(item, "name", emboss=False, text="")
|
||||
if context.scene.BIMWorkScheduleProperties.active_task_id == item.ifc_definition_id:
|
||||
if props.active_task_id == item.ifc_definition_id:
|
||||
row.operator("bim.edit_task", text="", icon="CHECKMARK")
|
||||
row.operator("bim.disable_editing_task", text="", icon="CANCEL")
|
||||
if context.scene.BIMWorkScheduleProperties.active_task_id:
|
||||
elif props.active_task_id:
|
||||
if props.active_task_id in Data.tasks[item.ifc_definition_id]["IsPredecessorTo"]:
|
||||
row.operator("bim.unassign_predecessor", text="", icon="BACK", emboss=False).task = item.ifc_definition_id
|
||||
else:
|
||||
row.operator("bim.assign_predecessor", text="", icon="TRACKING_BACKWARDS", emboss=False).task = item.ifc_definition_id
|
||||
|
||||
if props.active_task_id in Data.tasks[item.ifc_definition_id]["IsSuccessorFrom"]:
|
||||
row.operator("bim.unassign_successor", text="", icon="FORWARD", emboss=False).task = item.ifc_definition_id
|
||||
else:
|
||||
row.operator("bim.assign_successor", text="", icon="TRACKING_FORWARDS", emboss=False).task = item.ifc_definition_id
|
||||
|
||||
row.operator("bim.add_task", text="", icon="ADD").task = item.ifc_definition_id
|
||||
row.operator("bim.remove_task", text="", icon="X").task = item.ifc_definition_id
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user