Skip to content
Paul Ebbers edited this page Mar 10, 2025 · 4 revisions

Scripts are provided to help setup and customize the FreeCAD Ribbon.

The script are located in the directory "Scripts" in the folder of this add-on. For example, in windows this is:
"C:\Users<User name>\AppData\Roaming\FreeCAD\Mod\FreeCAD-Ribbon\Scripts"

You can of course customize these scripts or add your own scripts if you like. These will then also appear in the script menu. Click on a script and it will be opened in FreeCAD. You can then run it by pressing Ctrl+F6 or go to Macro -> Execute macro.

CreateDefaultRibbonStructure.py

This macro is ment to create a starting point for your own Ribbon design. When running this script, for every workbench every first command of a panel will be set to large. If you have already some customizations done for a workbench you can add this to the script. Comments are provided within the script to clarify the functions. The standard customization as provided with the Ribbon is already added to the script.

After running this script, a file called "RibbonStructure_default.json" is created. This is used by the Ribbon Design Dialog to reset the ribbon.
You can change the name of this file to a different name if you like.

FixRibbonStructure.py
This script can be used to fix errors in the file "RibbonStructure.json". It will look for panels under workbenches that shouldn't be there and removes them. This cleans up the file and can help resolve issues with errors like unable to remove separators.

GenerateCommandsList.py
With this script you can create a list of commands. The list looks as shown in the picture below.

A list item consists of the commandname followed by a list. This list consists of three items:

  1. The name of the workbench to which the command belongs to
  2. The menu text of this command. (This is what is shown on the ribbon by default)
  3. Three dots. You can replace these dots with your own menu text. This command list is used by the next script: "UpdateCommandNames.py"

As with "CreateDefaultRibbonStructure.py" you can add toolbars, workbenches, icon only toolbars, etc to the various lists. These will be ignored by the script.

UpdateCommandNames.py
With this script you can update your "RibbonStructure.json" file with your custom menu text. If you want to update a different json file, you can change this in the script.

Clone this wiki locally