Browse Source

Added possibility to render multiple pages in batch

master
Youen 2 years ago
parent
commit
731b203c5e
  1. 13
      ahb_cmd_view_refresh.py

13
ahb_cmd_view_refresh.py

@ -4,7 +4,7 @@ import FreeCAD as App
class AHB_RefreshView: class AHB_RefreshView:
def GetResources(self): def GetResources(self):
return {"MenuText": "Refresh page (final quality)", return {"MenuText": "Refresh page (final quality)",
"ToolTip": "Redraws the current page", "ToolTip": "Redraws the current page, or if one or more pages are selected, redraw all the selected pages",
"Pixmap": "" "Pixmap": ""
} }
@ -14,6 +14,17 @@ class AHB_RefreshView:
def Activated(self): def Activated(self):
workbench = Gui.getWorkbench("AssemblyHandbookWorkbench") #: :type workbench: AssemblyHandbookWorkbench workbench = Gui.getWorkbench("AssemblyHandbookWorkbench") #: :type workbench: AssemblyHandbookWorkbench
selection = Gui.Selection.getSelection()
has_selected_pages = len(selection) > 0
for s in selection:
if s.TypeId != 'TechDraw::DrawPage':
has_selected_pages = False
if has_selected_pages:
for page in selection:
workbench.techDrawExtensions.forceRedrawPage(page, fast_render = False)
else:
page = workbench.techDrawExtensions.getActivePage() page = workbench.techDrawExtensions.getActivePage()
if page is not None: if page is not None:
workbench.techDrawExtensions.forceRedrawPage(page, fast_render = False) workbench.techDrawExtensions.forceRedrawPage(page, fast_render = False)

Loading…
Cancel
Save