String representations of Workbenches and Dialog windows

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
xXxStYxXx
Posts: 27
Joined: Sat Sep 24, 2022 9:27 pm

String representations of Workbenches and Dialog windows

Post by xXxStYxXx »

Hello, I started to learn Python scripting in FreeCAD and noticed that a lot of commands require a string with the name of workbench or dialog window.
Commands like these:

Code: Select all

Gui.activateWorkbench()
Gui.runCommand()
In FreeCAD I can see strings like "Std_Workbench", "DraftWorkbench", "Std_DlgPreferences" and I wanted to know if there is a full list of strings to parts of FreeCAD
xXxStYxXx
Posts: 27
Joined: Sat Sep 24, 2022 9:27 pm

Re: String representations of Workbenches and Dialog windows

Post by xXxStYxXx »

Sorry, forgot to add

Code: Select all

OS: Ubuntu 22.04.1 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.21.31063 (Git)
Build type: Unknown
Branch: master
Hash: 7b2a6a3bf7c7cd409be25630d359a316f74fa9fd
Python 3.10.6, Qt 5.15.3, Coin 4.0.0, Vtk 9.1.0, OCC 7.5.1
Locale: English/United States (en_US)
User avatar
Roy_043
Veteran
Posts: 8578
Joined: Thu Dec 27, 2018 12:28 pm

Re: String representations of Workbenches and Dialog windows

Post by Roy_043 »

There is this:

Code: Select all

Gui.listWorkbenches()
Gui.listCommands()
Note that the return value of Gui.listCommands() depends on the workbenches that have been loaded in the current session.
Post Reply