Build untested IFC to P6 XML export feature.

This commit is contained in:
Dion Moult
2022-01-25 16:44:37 +11:00
parent 3222c9ce99
commit 01f25528e8
4 changed files with 282 additions and 73 deletions
@@ -20,86 +20,87 @@ import bpy
from . import ui, prop, operator
classes = (
operator.AddWorkPlan,
operator.EditWorkPlan,
operator.RemoveWorkPlan,
operator.EnableEditingWorkPlan,
operator.DisableEditingWorkPlan,
operator.EnableEditingWorkPlanSchedules,
operator.AssignWorkSchedule,
operator.UnassignWorkSchedule,
operator.AddWorkSchedule,
operator.EditWorkSchedule,
operator.RemoveWorkSchedule,
operator.EnableEditingWorkSchedule,
operator.EnableEditingTasks,
operator.DisableEditingWorkSchedule,
operator.DisableEditingSequence,
operator.EditSequenceAttributes,
operator.EditSequenceTimeLag,
operator.EnableEditingSequenceAttributes,
operator.EnableEditingSequenceTimeLag,
operator.AddSummaryTask,
operator.AddTask,
operator.AddTaskColumn,
operator.AddTimePeriod,
operator.AddWorkCalendar,
operator.EditWorkCalendar,
operator.EditWorkTime,
operator.RemoveWorkCalendar,
operator.RemoveWorkTime,
operator.UnassignRecurrencePattern,
operator.UnassignLagTime,
operator.RemoveTimePeriod,
operator.EnableEditingWorkCalendar,
operator.EnableEditingWorkTime,
operator.EnableEditingWorkCalendarTimes,
operator.DisableEditingWorkCalendar,
operator.DisableEditingWorkTime,
operator.AddWorkPlan,
operator.AddWorkSchedule,
operator.AddWorkTime,
operator.AssignLagTime,
operator.AssignRecurrencePattern,
operator.AddTimePeriod,
operator.AddTask,
operator.AddSummaryTask,
operator.ExpandTask,
operator.ContractTask,
operator.RemoveTask,
operator.EnableEditingTask,
operator.DisableEditingTask,
operator.DisableEditingTaskTime,
operator.EditTask,
operator.CopyTaskAttribute,
operator.AssignPredecessor,
operator.AssignSuccessor,
operator.UnassignPredecessor,
operator.UnassignSuccessor,
operator.EnableEditingTaskTime,
operator.EnableEditingTaskCalendar,
operator.EnableEditingTaskSequence,
operator.EditTaskTime,
operator.EditTaskCalendar,
operator.RemoveTaskCalendar,
operator.AssignProduct,
operator.UnassignProduct,
operator.AssignProcess,
operator.UnassignProcess,
operator.GenerateGanttChart,
operator.ImportP6,
operator.ImportP6XER,
operator.ImportPP,
operator.ImportMSP,
operator.LoadTaskProperties,
operator.SelectTaskRelatedProducts,
operator.VisualiseWorkScheduleDate,
operator.VisualiseWorkScheduleDateRange,
operator.RecalculateSchedule,
operator.AssignProduct,
operator.AssignRecurrencePattern,
operator.AssignSuccessor,
operator.AssignWorkSchedule,
operator.BlenderBIM_DatePicker,
operator.BlenderBIM_DatePickerSetDate,
operator.BlenderBIM_RedrawDatePicker,
operator.AddTaskColumn,
operator.RemoveTaskColumn,
operator.SetTaskSortColumn,
operator.LoadTaskInputs,
operator.LoadTaskResources,
operator.LoadTaskOutputs,
operator.CalculateTaskDuration,
operator.ContractTask,
operator.CopyTaskAttribute,
operator.DisableEditingSequence,
operator.DisableEditingTask,
operator.DisableEditingTaskTime,
operator.DisableEditingWorkCalendar,
operator.DisableEditingWorkPlan,
operator.DisableEditingWorkSchedule,
operator.DisableEditingWorkTime,
operator.EditSequenceAttributes,
operator.EditSequenceTimeLag,
operator.EditTask,
operator.EditTaskCalendar,
operator.EditTaskTime,
operator.EditWorkCalendar,
operator.EditWorkPlan,
operator.EditWorkSchedule,
operator.EditWorkTime,
operator.EnableEditingSequenceAttributes,
operator.EnableEditingSequenceTimeLag,
operator.EnableEditingTask,
operator.EnableEditingTaskCalendar,
operator.EnableEditingTaskSequence,
operator.EnableEditingTaskTime,
operator.EnableEditingTasks,
operator.EnableEditingWorkCalendar,
operator.EnableEditingWorkCalendarTimes,
operator.EnableEditingWorkPlan,
operator.EnableEditingWorkPlanSchedules,
operator.EnableEditingWorkSchedule,
operator.EnableEditingWorkTime,
operator.ExpandTask,
operator.ExportP6,
operator.GenerateGanttChart,
operator.ImportMSP,
operator.ImportP6,
operator.ImportP6XER,
operator.ImportPP,
operator.LoadTaskInputs,
operator.LoadTaskOutputs,
operator.LoadTaskProperties,
operator.LoadTaskResources,
operator.RecalculateSchedule,
operator.RemoveTask,
operator.RemoveTaskCalendar,
operator.RemoveTaskColumn,
operator.RemoveTimePeriod,
operator.RemoveWorkCalendar,
operator.RemoveWorkPlan,
operator.RemoveWorkSchedule,
operator.RemoveWorkTime,
operator.SelectTaskRelatedProducts,
operator.SetTaskSortColumn,
operator.UnassignLagTime,
operator.UnassignPredecessor,
operator.UnassignProcess,
operator.UnassignProduct,
operator.UnassignRecurrencePattern,
operator.UnassignSuccessor,
operator.UnassignWorkSchedule,
operator.VisualiseWorkScheduleDate,
operator.VisualiseWorkScheduleDateRange,
prop.WorkPlan,
prop.BIMWorkPlanProperties,
prop.Task,
@@ -124,6 +125,10 @@ classes = (
)
def menu_func_export(self, context):
self.layout.operator(operator.ExportP6.bl_idname, text="P6 (.xml)")
def menu_func_import(self, context):
self.layout.operator(operator.ImportP6.bl_idname, text="P6 (.xml)")
self.layout.operator(operator.ImportP6XER.bl_idname, text="P6 (.xer)")
@@ -138,6 +143,7 @@ def register():
bpy.types.Scene.BIMWorkCalendarProperties = bpy.props.PointerProperty(type=prop.BIMWorkCalendarProperties)
bpy.types.Scene.DatePickerProperties = bpy.props.PointerProperty(type=prop.DatePickerProperties)
bpy.types.TextCurve.BIMDateTextProperties = bpy.props.PointerProperty(type=prop.BIMDateTextProperties)
bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
@@ -148,4 +154,5 @@ def unregister():
del bpy.types.Scene.BIMWorkCalendarProperties
del bpy.types.Scene.DatePickerProperties
del bpy.types.TextCurve.BIMDateTextProperties
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
@@ -1196,6 +1196,31 @@ class ImportMSP(bpy.types.Operator, ImportHelper):
return {"FINISHED"}
class ExportP6(bpy.types.Operator, ImportHelper):
bl_idname = "export_p6.bim"
bl_label = "Export P6"
bl_options = {"REGISTER", "UNDO"}
filename_ext = ".xml"
filter_glob: bpy.props.StringProperty(default="*.xml", options={"HIDDEN"})
@classmethod
def poll(cls, context):
ifc_file = IfcStore.get_file()
return ifc_file is not None
def execute(self, context):
from ifc4d.ifc2p6 import Ifc2P6
self.file = IfcStore.get_file()
start = time.time()
ifc2p6 = Ifc2P6()
ifc2p6.xml = self.filepath
ifc2p6.file = self.file
ifc2p6.execute()
print("Import finished in {:.2f} seconds".format(time.time() - start))
return {"FINISHED"}
class EnableEditingWorkCalendarTimes(bpy.types.Operator):
bl_idname = "bim.enable_editing_work_calendar_times"
bl_label = "Enable Editing Work Calendar Times"