Demo : Preferences Page
A workbench that registers a preferences page in FreeCADβs preferences dialog. The page exposes six controls (combo box, line edit, spin box, double spin box, two check boxes) for configuring a Transmogrifier. A single command reads the current preferences and reports the configured operation in the Report view and a dialog.

This demo is the runnable companion to the Preferences pages guide. Every file is dedicated to the public domain under CC0-1.0; copy and adapt freely. Many thanks to Bill Watterson for the invention of the transmogrifier in the first place.
Directory layout
Transmogrifier/
ββ package.xml
ββ Resources/
β ββ Icons/
β β ββ Logo.svg
β β ββ preferences-transmogrifier.svg
β ββ panels/
β ββ TransmogrifierPrefs.ui
ββ freecad/
ββ Transmogrifier/
ββ __init__.py
ββ init_gui.py
ββ Commands.py
The .ui file lives outside the namespace package so its path is straightforward to compute from __file__: three directories up to the addon root, then into Resources/panels/.
The files
package.xml
The Addon Manifest declares the workbench. The preferences page is not declared in the manifest; FreeCAD discovers it via addPreferencePage calls at workbench startup.
Source: package.xml
Resources/panels/TransmogrifierPrefs.ui
The Qt Designer form. The file is hand-written XML for this demo, but in production you would create it visually in Qt Designer (with FreeCADβs plugin loaded) and have it generate the same XML.
Each input control is one of FreeCADβs Gui::Pref* widgets, with prefEntry and prefPath properties that name the parameter key and storage path. FreeCAD reads stored values into these widgets when the preferences dialog opens, and writes their final values back when the user clicks OK.
Source: TransmogrifierPrefs.ui
freecad/Transmogrifier/init_gui.py
Defines TransmogrifierWorkbench. After defining the class, the file:
- Calls
FreeCADGui.addIconPathso FreeCAD can locatepreferences-transmogrifier.svgfor the preferences sidebar. - Registers the workbench.
- Calls
FreeCADGui.addPreferencePagewith the path to the.uifile and the group name"Transmogrifier"for the sidebar.
Source: init_gui.py
freecad/Transmogrifier/Commands.py
Defines EngageCommand. Its Activated() method reads each preference from FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Transmogrifier") and reports the configured operation in the Report view and a QMessageBox.
Source: Commands.py
freecad/Transmogrifier/__init__.py
Empty namespace-package marker.
Source: __init__.py
Trying it out
- Install the addon by downloading
Transmogrifier.zipand extracting it into your FreeCAD userMod/directory. To install from source instead, or to symlink for live edits, follow Installing your addon locally using theSource/directory next to this page. - Restart FreeCAD.
- Open Edit β Preferences. The Transmogrifier group should appear in the sidebar.
- Adjust the values and click OK to save them.
- Switch to the Transmogrifier workbench and click the Engage Transmogrifier toolbar button. The Report view and a dialog show the values that were saved.
- Reopen the preferences dialog. The values from step 4 are restored into the form.
Where to go next
- Preferences pages for the full pattern:
Gui::Pref*widgets,prefEntry/prefPath, andParamGetreads. - Workbench registration for the
init_gui.pywalk-through. - Gui Commands for the command pattern.