2022-10-18 21:35:35 +01:00
|
|
|
import FreeCADGui as Gui
|
|
|
|
import FreeCAD as App
|
|
|
|
|
2022-12-08 08:41:37 +00:00
|
|
|
import ahb_utils
|
2022-10-18 21:35:35 +01:00
|
|
|
class AHB_SetViewDirection:
|
|
|
|
def GetResources(self):
|
|
|
|
return {"MenuText": "Set view direction",
|
|
|
|
"ToolTip": "Applies the current 3D view direction on the selected TechDraw view",
|
|
|
|
"Pixmap": ""
|
|
|
|
}
|
|
|
|
|
|
|
|
def IsActive(self):
|
2022-12-08 08:41:37 +00:00
|
|
|
return ahb_utils.getCurrentView() is not None
|
2022-10-18 21:35:35 +01:00
|
|
|
|
|
|
|
def Activated(self):
|
|
|
|
workbench = Gui.getWorkbench("AssemblyHandbookWorkbench") #: :type workbench: AssemblyHandbookWorkbench
|
2022-12-08 08:41:37 +00:00
|
|
|
view = ahb_utils.getCurrentView()
|
2022-10-18 21:35:35 +01:00
|
|
|
if view is None:
|
|
|
|
raise Exception("Please select a TechDraw view")
|
|
|
|
workbench.techDrawExtensions.setCurrentViewDirection(view)
|
|
|
|
|
|
|
|
|
|
|
|
from ahb_command import AHB_CommandWrapper
|
|
|
|
AHB_CommandWrapper.addGuiCommand('AHB_view_set_direction', AHB_SetViewDirection())
|