mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Add prototype drawing style UI
This commit is contained in:
@@ -180,6 +180,10 @@ if bpy is not None:
|
||||
operator.CalculateObjectVolumes,
|
||||
operator.AddOpening,
|
||||
operator.SetOverrideColour,
|
||||
operator.AddDrawingStyle,
|
||||
operator.RemoveDrawingStyle,
|
||||
operator.SaveDrawingStyle,
|
||||
operator.ActivateDrawingStyle,
|
||||
prop.StrProperty,
|
||||
prop.Variable,
|
||||
prop.Role,
|
||||
@@ -196,6 +200,7 @@ if bpy is not None:
|
||||
prop.ClashSource,
|
||||
prop.ClashSet,
|
||||
prop.Constraint,
|
||||
prop.DrawingStyle,
|
||||
prop.BcfTopic,
|
||||
prop.BcfTopicLabel,
|
||||
prop.BcfTopicFile,
|
||||
|
||||
@@ -3456,3 +3456,41 @@ class SetOverrideColour(bpy.types.Operator):
|
||||
area = next(area for area in bpy.context.screen.areas if area.type == 'VIEW_3D')
|
||||
area.spaces[0].shading.color_type = 'OBJECT'
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class AddDrawingStyle(bpy.types.Operator):
|
||||
bl_idname = 'bim.add_drawing_style'
|
||||
bl_label = 'Add Drawing Style'
|
||||
|
||||
def execute(self, context):
|
||||
new = bpy.context.scene.DocProperties.drawing_styles.add()
|
||||
new.name = 'New Drawing Style'
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class RemoveDrawingStyle(bpy.types.Operator):
|
||||
bl_idname = 'bim.remove_drawing_style'
|
||||
bl_label = 'Remove Drawing Style'
|
||||
index: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
bpy.context.scene.DocProperties.drawing_styles.remove(self.index)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class SaveDrawingStyle(bpy.types.Operator):
|
||||
bl_idname = 'bim.save_drawing_style'
|
||||
bl_label = 'Save Drawing Style'
|
||||
|
||||
def execute(self, context):
|
||||
# TODO
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class ActivateDrawingStyle(bpy.types.Operator):
|
||||
bl_idname = 'bim.activate_drawing_style'
|
||||
bl_label = 'Activate Drawing Style'
|
||||
|
||||
def execute(self, context):
|
||||
# TODO
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -400,6 +400,14 @@ class Subcontext(PropertyGroup):
|
||||
target_view: StringProperty(name='Target View')
|
||||
|
||||
|
||||
class DrawingStyle(PropertyGroup):
|
||||
name: StringProperty(name='Name')
|
||||
raster_style: StringProperty(name='Raster Style')
|
||||
vector_style: StringProperty(name='Vector Style')
|
||||
include_query: StringProperty(name='Include Query')
|
||||
exclude_query: StringProperty(name='Exclude Query')
|
||||
|
||||
|
||||
class DocProperties(PropertyGroup):
|
||||
should_recut: BoolProperty(name="Should Recut", default=True)
|
||||
should_recut_selected: BoolProperty(name="Should Recut Selected Only", default=False)
|
||||
@@ -410,6 +418,7 @@ class DocProperties(PropertyGroup):
|
||||
sheet_name: StringProperty(name="Sheet Name", update=refreshSheets)
|
||||
available_sheets: EnumProperty(items=getSheets, name="Available Sheets")
|
||||
ifc_files: CollectionProperty(name='IFCs', type=StrProperty)
|
||||
drawing_styles: CollectionProperty(name='Drawing Styles', type=DrawingStyle)
|
||||
|
||||
|
||||
class BIMCameraProperties(PropertyGroup):
|
||||
@@ -423,6 +432,7 @@ class BIMCameraProperties(PropertyGroup):
|
||||
('CUSTOM', 'Custom', '')
|
||||
], name='Cut Objects')
|
||||
cut_objects_custom: StringProperty(name='Custom Cut')
|
||||
active_drawing_style_index: IntProperty(name='Active Drawing Style Index')
|
||||
|
||||
|
||||
class BIMTextProperties(PropertyGroup):
|
||||
|
||||
@@ -823,7 +823,7 @@ class BIM_PT_section_plane(Panel):
|
||||
row.operator('bim.remove_section_plane')
|
||||
|
||||
class BIM_PT_camera(Panel):
|
||||
bl_label = "Diagrams and Documentation"
|
||||
bl_label = "Drawing Generation"
|
||||
bl_idname = "BIM_PT_camera"
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
@@ -870,8 +870,32 @@ class BIM_PT_camera(Panel):
|
||||
row = layout.row()
|
||||
row.prop(props, 'diagram_scale')
|
||||
|
||||
layout.label(text="Drawing Styles:")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator('bim.cut_section')
|
||||
row.operator('bim.add_drawing_style')
|
||||
|
||||
if dprops.drawing_styles:
|
||||
layout.template_list('BIM_UL_generic', '', dprops, 'drawing_styles', props, 'active_drawing_style_index')
|
||||
|
||||
if props.active_drawing_style_index < len(dprops.drawing_styles):
|
||||
drawing_style = dprops.drawing_styles[props.active_drawing_style_index]
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(drawing_style, 'name')
|
||||
row.operator('bim.remove_drawing_style', icon='X', text='').index = props.active_drawing_style_index
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(drawing_style, 'raster_style')
|
||||
row = layout.row(align=True)
|
||||
row.prop(drawing_style, 'vector_style')
|
||||
row = layout.row(align=True)
|
||||
row.prop(drawing_style, 'include_query')
|
||||
row = layout.row(align=True)
|
||||
row.prop(drawing_style, 'exclude_query')
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator('bim.cut_section', text='Create Drawing')
|
||||
op = row.operator('bim.open_view', icon='URL', text='')
|
||||
op.view = context.active_object.name.split('/')[1]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user