Added possibility to render multiple pages in batch

This commit is contained in:
Youen 2023-04-30 19:29:09 +02:00
parent 85b680d2f4
commit 731b203c5e

View File

@ -4,7 +4,7 @@ import FreeCAD as App
class AHB_RefreshView:
def GetResources(self):
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": ""
}
@ -14,9 +14,20 @@ class AHB_RefreshView:
def Activated(self):
workbench = Gui.getWorkbench("AssemblyHandbookWorkbench") #: :type workbench: AssemblyHandbookWorkbench
page = workbench.techDrawExtensions.getActivePage()
if page is not None:
workbench.techDrawExtensions.forceRedrawPage(page, fast_render = False)
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()
if page is not None:
workbench.techDrawExtensions.forceRedrawPage(page, fast_render = False)
from ahb_command import AHB_CommandWrapper
AHB_CommandWrapper.addGuiCommand('AHB_view_refresh', AHB_RefreshView())