Add button for camera to quickly open relevant drawing

This commit is contained in:
Dion Moult
2020-08-11 15:01:30 +10:00
parent cd6bd0e3cc
commit ffa4e7570d
2 changed files with 10 additions and 3 deletions
@@ -2037,11 +2037,12 @@ class CreateView(bpy.types.Operator):
class OpenView(bpy.types.Operator):
bl_idname = 'bim.open_view'
bl_label = 'Open View'
view: bpy.props.StringProperty()
def execute(self, context):
webbrowser.open('file://' + os.path.join(
bpy.context.scene.BIMProperties.data_dir, 'diagrams',
bpy.context.scene.DocProperties.available_views + '.svg'))
self.view + '.svg'))
return {'FINISHED'}
@@ -2167,6 +2168,7 @@ class CutSection(bpy.types.Operator):
svg_writer.scale = float(numerator) / float(denominator)
ifc_cutter.cut()
svg_writer.write()
bpy.ops.bim.open_view(view=self.diagram_name)
return {'FINISHED'}
def is_landscape(self):
+7 -2
View File
@@ -742,7 +742,8 @@ class BIM_PT_documentation(Panel):
row = layout.row()
row.prop(props, 'available_views', text='Available Drawings')
row.operator('bim.open_view', icon='URL', text='')
op = row.operator('bim.open_view', icon='URL', text='')
op.view = bpy.context.scene.DocProperties.available_views
row.operator('bim.activate_view', icon='SCENE', text='')
row = layout.row()
@@ -861,9 +862,13 @@ class BIM_PT_camera(Panel):
row = layout.row()
row.prop(props, 'cut_objects_custom')
row = layout.row()
row.prop(props, 'diagram_scale')
row = layout.row(align=True)
row.prop(props, 'diagram_scale', text='')
row.operator('bim.cut_section')
op = row.operator('bim.open_view', icon='URL', text='')
op.view = context.active_object.name.split('/')[1]
class BIM_PT_text(Panel):