Hello,
I have been working on a concept for an alternative ribbon style UI for freecad. If i can get some code to do the following 3 things I think I will be well on my way to implementing the idea.
First I am hoping that there is a simple way of programmatically list all of the commands available in the GUI along with the current status of those commands (available / unavailable, clickable or grayed out). I know this information must be available some where because of the toolbar customization tool.
Second I would need an example of some python code to activate or run an arbitrary command from the list as if the user had clicked the command from the menus.
Third I would like to be able to export PNG images for each of the icons associated to the commands.
Thanks for any help.
List output of all commands
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
List output of all commands
My main project is https://autodrop3d.com
Effort on https://github.com/mmiscool/FC-Docker FreeCAD for cloud with browser based access has been discontinued in favor of focused development on https://github.com/xibyte/jsketcher
Effort on https://github.com/mmiscool/FC-Docker FreeCAD for cloud with browser based access has been discontinued in favor of focused development on https://github.com/xibyte/jsketcher
Re: List output of all commands
I managed to get a listing of commands by exploring the Gui object.
It seems that the follwing code will give me a listing of the each of the commands as an array
print(Gui.listCommands())
Using the Gui.doCommandGui I can execute the command.
print(Gui.doCommandGui("name of command as astring")
I am still struggling to get the status of commands (enabled/or grayed out) and figuring out the icon file associated with each.
Any help would be appreciated.
It seems that the follwing code will give me a listing of the each of the commands as an array
print(Gui.listCommands())
Using the Gui.doCommandGui I can execute the command.
print(Gui.doCommandGui("name of command as astring")
I am still struggling to get the status of commands (enabled/or grayed out) and figuring out the icon file associated with each.
Any help would be appreciated.
My main project is https://autodrop3d.com
Effort on https://github.com/mmiscool/FC-Docker FreeCAD for cloud with browser based access has been discontinued in favor of focused development on https://github.com/xibyte/jsketcher
Effort on https://github.com/mmiscool/FC-Docker FreeCAD for cloud with browser based access has been discontinued in favor of focused development on https://github.com/xibyte/jsketcher
Re: List output of all commands
Is there a public repository you are building this on? Care to share it in the OP ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: List output of all commands
Not quite yet. This is actually a smaller portion of a larger project.
I do plan on putting some thing out after I get this part of it working. People should be pleasantly surprised by it I think.
And any snippets of code for outputting a listing of GUI commands and there status as to being enabled or disabled would be extremely helpful.
I do plan on putting some thing out after I get this part of it working. People should be pleasantly surprised by it I think.
And any snippets of code for outputting a listing of GUI commands and there status as to being enabled or disabled would be extremely helpful.
My main project is https://autodrop3d.com
Effort on https://github.com/mmiscool/FC-Docker FreeCAD for cloud with browser based access has been discontinued in favor of focused development on https://github.com/xibyte/jsketcher
Effort on https://github.com/mmiscool/FC-Docker FreeCAD for cloud with browser based access has been discontinued in favor of focused development on https://github.com/xibyte/jsketcher
Re: List output of all commands
hi
good idea
run the command:
for the icon in and image in gui
Qt_Example
for the icon in "FreeCAD" on a button
mario
good idea
run the command:
Code: Select all
>>> Gui.runCommand('Draft_Arc',0)
>>> Gui.runCommand('Std_Macro_11',0)
....
Qt_Example
for the icon in "FreeCAD" on a button
Code: Select all
self.image_04 = QtGui.QIcon.fromTheme("edit-delete") # icone resource de FreeCAD sur bouton
self.PB_Quit.setIcon(self.image_04) # icone resource de FreeCAD sur bouton
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
Re: List output of all commands
Thanks for the reply there Mario.
I am looking to extract the icon file associated with a command from the command. This way I can export it. Not trying to assign an icon file to a custom command.
I am looking to extract the icon file associated with a command from the command. This way I can export it. Not trying to assign an icon file to a custom command.
My main project is https://autodrop3d.com
Effort on https://github.com/mmiscool/FC-Docker FreeCAD for cloud with browser based access has been discontinued in favor of focused development on https://github.com/xibyte/jsketcher
Effort on https://github.com/mmiscool/FC-Docker FreeCAD for cloud with browser based access has been discontinued in favor of focused development on https://github.com/xibyte/jsketcher
Re: List output of all commands
hi
see "for the icon in "FreeCAD" on a button" above
example usage Gui.runCommand() Std_DrawStyle
other example use Gui.runCommand() [Macro] Bit of help for super users by openBrain
mario
see "for the icon in "FreeCAD" on a button" above
example usage Gui.runCommand() Std_DrawStyle
other example use Gui.runCommand() [Macro] Bit of help for super users by openBrain
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.