I have FC 0.17. I would like to add a new command to the exiting TechDraw workbench. How I can do it? I have tried to modify the InitGui.py of that workbench.
This is the code:
Code: Select all
class TechDrawWorkbench (Workbench):
"Technical Drawing workbench object"
def __init__(self):
self.__class__.Icon = FreeCAD.getResourceDir() + "Mod/TechDraw/Resources/icons/preferences-techdraw.svg"
self.__class__.MenuText = "TechDraw"
self.__class__.ToolTip = "Technical Drawing workbench"
def Initialize(self):
#import SandwichGUI, Lattice1 # import here all the needed files that create your FreeCAD commands
self.list = ["LatticeCommand"]
self.appendToolbar("Lattice",self.list) # creates a new toolbar with your commands
self.appendMenu("Lattice",self.list)
def Activated(self):
return
def Deactivated(self):
return
def ContextMenu(self, recipient):
self.appendContextMenu("Lattice",self.list) # add commands to the context menu
def Initialize(self):
# load the module
import TechDrawGui
def GetClassName(self):
return "TechDrawGui::Workbench"
Gui.addWorkbench(TechDrawWorkbench())
class LatticeCommand_Class():
def GetResources(self):
return {'Pixmap' : 'C:\Program Files\FreeCAD 0.17\Mod\TechDraw\Lat_icon.bmp',
'Accel': "",
'MenuText': "Lattice",
'ToolTip': "Quote lattice structure"}
def Activated(self):
import Lattice_QuoteGUI
while True:
reload(Lattice_QuoteGUI)
return
FreeCADGui.addCommand('LatticeCommand',LatticeCommand_Class())