Part: Add Sketcher_NewSketch to Part toolbar (#14318)

* Update Workbench.cpp

* Part: Update InitGui.py
This commit is contained in:
FEA-eng
2024-06-10 17:36:39 +02:00
committed by GitHub
parent a7e1760bfb
commit f5486bca3e
2 changed files with 20 additions and 1 deletions

View File

@@ -122,6 +122,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
<< "Separator"
<< bop << join << split << compound
<< "Separator"
<< "Sketcher_NewSketch"
<< "Part_Extrude"
<< "Part_Revolve"
<< "Part_Mirror"
@@ -170,7 +171,8 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
Gui::ToolBarItem* tool = new Gui::ToolBarItem(root);
tool->setCommand("Part tools");
*tool << "Part_Extrude"
*tool << "Sketcher_NewSketch"
<< "Part_Extrude"
<< "Part_Revolve"
<< "Part_Mirror"
<< "Part_Scale"

View File

@@ -38,6 +38,21 @@ class PartWorkbench(Gui.Workbench):
self.__class__.MenuText = "Part"
self.__class__.ToolTip = "Part workbench"
def tryAddManipulator(self):
try:
import SketcherGui
class Manipulator:
def modifyToolBars(self):
return [{"insert" : "Sketcher_NewSketch", "toolItem" : "Part_Extrude"}]
def modifyMenuBar(self):
return [{"insert" : "Sketcher_NewSketch", "menuItem" : "Part_Extrude"}]
manip = Manipulator()
Gui.addWorkbenchManipulator(manip)
except ImportError as err:
pass
def Initialize(self):
# load the module
import PartGui
@@ -64,6 +79,8 @@ class PartWorkbench(Gui.Workbench):
App.Console.PrintError("'BOPTools' package cannot be loaded. "
"{err}\n".format(err=str(err)))
self.tryAddManipulator()
def GetClassName(self):
return "PartGui::Workbench"