mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
You can now refresh the drawing list, in case you are manually creating drawings
This commit is contained in:
@@ -201,6 +201,7 @@ if bpy is not None:
|
||||
operator.CopyPropertyToSelection,
|
||||
operator.CreateShapeFromStepId,
|
||||
operator.SelectHighPolygonMeshes,
|
||||
operator.RefreshDrawingList,
|
||||
prop.StrProperty,
|
||||
prop.Variable,
|
||||
prop.Role,
|
||||
|
||||
@@ -3984,3 +3984,22 @@ class SelectHighPolygonMeshes(bpy.types.Operator):
|
||||
if relating_type:
|
||||
relating_type.select_set(True)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class RefreshDrawingList(bpy.types.Operator):
|
||||
bl_idname = 'bim.refresh_drawing_list'
|
||||
bl_label = 'Refresh Drawing List'
|
||||
|
||||
def execute(self, context):
|
||||
while len(bpy.context.scene.DocProperties.drawings) > 0:
|
||||
bpy.context.scene.DocProperties.drawings.remove(0)
|
||||
for obj in bpy.data.objects:
|
||||
if not isinstance(obj.data, bpy.types.Camera):
|
||||
continue
|
||||
print(obj)
|
||||
if 'IfcGroup/' in obj.name and obj.users_collection[0].name == obj.name:
|
||||
print(obj)
|
||||
new = bpy.context.scene.DocProperties.drawings.add()
|
||||
new.name = obj.name.split('/')[1]
|
||||
new.camera = obj
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -736,12 +736,13 @@ class BIM_PT_drawings(Panel):
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator('bim.add_drawing')
|
||||
row.operator('bim.refresh_drawing_list', icon='FILE_REFRESH', text='')
|
||||
|
||||
if props.drawings:
|
||||
op = row.operator('bim.open_view', icon='URL', text='')
|
||||
op.view = props.drawings[props.active_drawing_index].name
|
||||
row.operator('bim.remove_drawing', icon='X', text='').index = props.active_drawing_index
|
||||
|
||||
if props.active_drawing_index < len(props.drawings):
|
||||
op = row.operator('bim.open_view', icon='URL', text='')
|
||||
op.view = props.drawings[props.active_drawing_index].name
|
||||
row.operator('bim.remove_drawing', icon='X', text='').index = props.active_drawing_index
|
||||
layout.template_list('BIM_UL_generic', '', props, 'drawings', props, 'active_drawing_index')
|
||||
|
||||
row = layout.row()
|
||||
@@ -1963,12 +1964,13 @@ class BIM_PT_annotation_utilities(Panel):
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator('bim.add_drawing')
|
||||
row.operator('bim.refresh_drawing_list', icon='FILE_REFRESH', text='')
|
||||
|
||||
if props.drawings:
|
||||
op = row.operator('bim.open_view', icon='URL', text='')
|
||||
op.view = props.drawings[props.active_drawing_index].name
|
||||
row.operator('bim.remove_drawing', icon='X', text='').index = props.active_drawing_index
|
||||
|
||||
if props.active_drawing_index < len(props.drawings):
|
||||
op = row.operator('bim.open_view', icon='URL', text='')
|
||||
op.view = props.drawings[props.active_drawing_index].name
|
||||
row.operator('bim.remove_drawing', icon='X', text='').index = props.active_drawing_index
|
||||
layout.template_list('BIM_UL_generic', '', props, 'drawings', props, 'active_drawing_index')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user