Add Button to FEM Toolbar Tutorial

Notes: Work In Progress

FEM workbench has toolbars and menus. This tutorial shows how to add a test button onto the toolbars. It also shows how to add a menuitem into the menu.

The task can be split into four parts:
 * Create a new icon file.
 * Register the new icon file. Make change at src/Mod/Fem//Gui/Resources/Fem.qrc
 * Create a new command class. Make change at src/Mod/Fem/femcommands/commands.py
 * Add the new command onto the workbench. Make change at src/Mod/Fem/Gui/Workbench.cpp

Create a new icon file
For a button, we need an icon file. You can use any of your favorite tools to create it, but it must be in SVG format. Here we use file as an example.

It must be placed into:

Register the new icon file
The new SVG icon file has to be registered for the GUI-button by inserting it into :

Create a new command class
A new command class has to be added to the module.

Just copy/paste an existing command, then adjust the icon, menu textm and tool-tip in

Important: Don't forget to register the command at the bottom of the module file by using the method.

Note: Please see the discussion thread in the forum if icons are involved.

Add the new command onto the workbench
The FEM workbench has several toolbars and menus. We will add the new command on to both the solve toolbar and the solve menu.

Search for the following code snippet in and add the new command.

To add the command to the solve menu of the FEM workbench, search for the following code snippet in.

You have just added an test button onto FEM workbench toolbar and menu. Now, you can compile your own FreeCAD and test your new button.