mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
New UI to add and manage schedules from ODS spreadsheets
This commit is contained in:
@@ -186,6 +186,9 @@ if bpy is not None:
|
||||
operator.EditVectorStyle,
|
||||
operator.PurgeProjectClassifications,
|
||||
operator.RemoveSheet,
|
||||
operator.AddSchedule,
|
||||
operator.RemoveSchedule,
|
||||
operator.SelectScheduleFile,
|
||||
prop.StrProperty,
|
||||
prop.Variable,
|
||||
prop.Role,
|
||||
@@ -203,6 +206,7 @@ if bpy is not None:
|
||||
prop.ClashSet,
|
||||
prop.Constraint,
|
||||
prop.Drawing,
|
||||
prop.Schedule,
|
||||
prop.DrawingStyle,
|
||||
prop.Sheet,
|
||||
prop.BcfTopic,
|
||||
@@ -231,6 +235,7 @@ if bpy is not None:
|
||||
prop.BIMTextProperties,
|
||||
ui.BIM_PT_section_plane,
|
||||
ui.BIM_PT_drawings,
|
||||
ui.BIM_PT_schedules,
|
||||
ui.BIM_PT_sheets,
|
||||
ui.BIM_PT_bim,
|
||||
ui.BIM_PT_psets,
|
||||
|
||||
@@ -3626,3 +3626,41 @@ class RemoveSheet(bpy.types.Operator):
|
||||
props = bpy.context.scene.DocProperties
|
||||
props.sheets.remove(self.index)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class AddSchedule(bpy.types.Operator):
|
||||
bl_idname = 'bim.add_schedule'
|
||||
bl_label = 'Add Schedule'
|
||||
|
||||
def execute(self, context):
|
||||
new = bpy.context.scene.DocProperties.schedules.add()
|
||||
new.name = 'SCHEDULE {}'.format(len(bpy.context.scene.DocProperties.schedules))
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class RemoveSchedule(bpy.types.Operator):
|
||||
bl_idname = 'bim.remove_schedule'
|
||||
bl_label = 'Remove Schedule'
|
||||
index: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
props = bpy.context.scene.DocProperties
|
||||
props.schedules.remove(self.index)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class SelectScheduleFile(bpy.types.Operator):
|
||||
bl_idname = "bim.select_schedule_file"
|
||||
bl_label = "Select Documentation IFC File"
|
||||
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
||||
filter_glob: bpy.props.StringProperty(default="*.ods", options={'HIDDEN'})
|
||||
index: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
props = bpy.context.scene.DocProperties
|
||||
props.schedules[props.active_schedule_index].file = self.filepath
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
context.window_manager.fileselect_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
@@ -437,6 +437,11 @@ class Drawing(PropertyGroup):
|
||||
camera: PointerProperty(name='Camera', type=bpy.types.Object)
|
||||
|
||||
|
||||
class Schedule(PropertyGroup):
|
||||
name: StringProperty(name='Name')
|
||||
file: StringProperty(name='File')
|
||||
|
||||
|
||||
class Sheet(PropertyGroup):
|
||||
def set_name(self, new):
|
||||
old = self.get('name')
|
||||
@@ -468,6 +473,8 @@ class DocProperties(PropertyGroup):
|
||||
should_extract: BoolProperty(name="Should Extract", default=True)
|
||||
drawings: CollectionProperty(name='Drawings', type=Drawing)
|
||||
active_drawing_index: IntProperty(name='Active Drawing Index')
|
||||
schedules: CollectionProperty(name='Schedules', type=Schedule)
|
||||
active_schedule_index: IntProperty(name='Active Schedule Index')
|
||||
sheets: CollectionProperty(name='Sheets', type=Sheet)
|
||||
active_sheet_index: IntProperty(name='Active Sheet Index')
|
||||
ifc_files: CollectionProperty(name='IFCs', type=StrProperty)
|
||||
|
||||
@@ -750,6 +750,31 @@ class BIM_PT_drawings(Panel):
|
||||
row.operator('bim.remove_ifc_file', icon='X', text='').index = index
|
||||
|
||||
|
||||
class BIM_PT_schedules(Panel):
|
||||
bl_label = "ODS Schedules"
|
||||
bl_idname = "BIM_PT_schedules"
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = 'output'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
props = bpy.context.scene.DocProperties
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator('bim.add_schedule')
|
||||
|
||||
if props.schedules:
|
||||
row.operator('bim.remove_schedule', icon='X', text='').index = props.active_schedule_index
|
||||
|
||||
layout.template_list('BIM_UL_generic', '', props, 'schedules', props, 'active_schedule_index')
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props.schedules[props.active_schedule_index], 'file')
|
||||
row.operator('bim.select_schedule_file', icon='FILE_FOLDER', text='')
|
||||
|
||||
|
||||
class BIM_PT_sheets(Panel):
|
||||
bl_label = "SVG Sheets"
|
||||
bl_idname = "BIM_PT_sheets"
|
||||
|
||||
Reference in New Issue
Block a user