mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 10:57:49 +00:00
BBIM - New Sequence Toolkit Panel & new feature to highlight tasks for current selected object
This commit is contained in:
@@ -20,6 +20,7 @@ import bpy
|
||||
from . import ui, prop, operator
|
||||
|
||||
classes = (
|
||||
operator.HighlightProductRelatedTask,
|
||||
operator.ExpandAllTasks,
|
||||
operator.ContractAllTasks,
|
||||
operator.AddSummaryTask,
|
||||
@@ -127,6 +128,7 @@ classes = (
|
||||
ui.BIM_UL_task_resources,
|
||||
ui.BIM_UL_task_outputs,
|
||||
ui.BIM_UL_tasks,
|
||||
ui.BIM_PT_SequenceToolKit,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1507,6 +1507,19 @@ class CalculateTaskDuration(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
def _execute(self, context):
|
||||
core.calculate_task_duration(tool.Ifc, tool.Sequence, task=tool.Ifc.get().by_id(self.task))
|
||||
|
||||
|
||||
class HighlightProductRelatedTask(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_idname = "bim.highlight_product_related_task"
|
||||
bl_label = "Highlights the related task"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
bl_description = "Finds the related Task"
|
||||
product_type: bpy.props.StringProperty()
|
||||
|
||||
def _execute(self, context):
|
||||
core.highlight_product_related_task(tool.Sequence, product_type=self.product_type)
|
||||
|
||||
|
||||
class ExpandAllTasks(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_idname = "bim.expand_all_tasks"
|
||||
bl_label = "Expands all tasks"
|
||||
|
||||
@@ -732,3 +732,16 @@ class BIM_PT_work_calendars(Panel):
|
||||
|
||||
def draw_editable_ui(self):
|
||||
draw_attributes(self.props.work_calendar_attributes, self.layout)
|
||||
|
||||
class BIM_PT_SequenceToolKit(Panel):
|
||||
bl_label = "Sequence Toolkit"
|
||||
bl_idname = "BIM_PT_Sequence_toolkit"
|
||||
bl_space_type = "VIEW_3D"
|
||||
bl_region_type = "UI"
|
||||
bl_category = "Sequence Toolkit"
|
||||
|
||||
def draw(self, context):
|
||||
row = self.layout.row()
|
||||
row.operator("bim.highlight_product_related_task", text="Go to Input-related Task ", icon="STYLUS_PRESSURE").product_type = "Input"
|
||||
row = self.layout.row()
|
||||
row.operator("bim.highlight_product_related_task", text="Go to Output-related Task ",icon="STYLUS_PRESSURE").product_type = "Output"
|
||||
@@ -454,3 +454,17 @@ def calculate_task_duration(ifc, sequence, task=None):
|
||||
if work_schedule:
|
||||
sequence.create_task_tree(work_schedule)
|
||||
sequence.load_task_properties()
|
||||
|
||||
|
||||
def highlight_product_related_task(sequence, product_type=None):
|
||||
products = sequence.get_selected_products()
|
||||
if products:
|
||||
if product_type == "Output":
|
||||
tasks = sequence.find_related_output_tasks(products[0])
|
||||
elif product_type == "Input":
|
||||
tasks = sequence.find_related_input_tasks(products[0])
|
||||
for task in tasks:
|
||||
work_schedule = sequence.get_work_schedule(task)
|
||||
is_work_schedule_active = sequence.is_work_schedule_active(work_schedule)
|
||||
if is_work_schedule_active:
|
||||
sequence.highlight_task(task)
|
||||
|
||||
Reference in New Issue
Block a user