Creating A Workbench

Need help, or want to share a macro? Post here!
Posts: 12
Joined: Thu Jan 10, 2019 5:48 pm

Creating A Workbench

Postby Zig_mint » Sun Mar 17, 2019 12:15 pm


I wish to create a workbench of my own where I keep all the tools which I use on a regular basis but I can't happen to find a way to do it.

The attached image shows that I have made a workbench with the name ZIGMINT now next I want to add two tools from Sketcher Workbench namely the "line tool" and "circle tool".

I have made my workbench to imports MyGeometry module where I will keep the two above mentioned tools, but I am not able to write the code for MyGeometry module.

Also when I checked the SketcherGui and Sketcher Module I found that they were in .pyd format and out of my scope of understanding.
Please shed some light. Thanks in advance.

Code: Select all

class ZigMint (Workbench):

    MenuText = "ZigMint"
    ToolTip = "this workbench places all my tools regularly used tools at one place"
    //Icon = """!@#$%^&"""

    def Initialize(self):
        import MyGeometry 
        self.list = ["MakeLine, MakeCircle"] # A list of command names created in the line above
        self.appendMenu(["ZigMint","Tools"],self.list) # appends a submenu to an existing menu
    def Activated(self):
        "This function is executed when the workbench is activated"

    def Deactivated(self):
        "This function is executed when the workbench is deactivated"

    def ContextMenu(self, recipient):
        self.appendContextMenu("My commands",self.list) # add commands to the context menu

    def GetClassName(self): 
        return "Gui::PythonWorkbench"
Attachments (170.72 KiB) Viewed 235 times