[Help] How to get WBs, Toolbars, Tools

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

[Help] How to get WBs, Toolbars, Tools

Post by HakanSeven12 »

I can get WBs with that code

Code: Select all

wbList = Gui.listWorkbenches()
How can I know which workbench contains which toolbar and which toolbar contains which tool. I'm trying to create a ribbon for freecad. so I need a hierarchical structure of them.


ribbon.png
ribbon.png (108.84 KiB) Viewed 1815 times

How can I access this list?


panel.png
panel.png (99.7 KiB) Viewed 1619 times
Last edited by HakanSeven12 on Fri Apr 03, 2020 3:36 pm, edited 6 times in total.
mario52
Veteran
Posts: 4673
Joined: Wed May 16, 2012 2:13 pm

Re: How to get WBs, Toolbars, Tools

Post by mario52 »

hi

is there a shortcut for 'Preference' panel?

Code: Select all

Gui.listCommands()	# liste les commandes

Gui.runCommand("Std_DlgPreferences") # execute la commande

Gui.runCommand("Part_Box")  # execute la commande

list the button (link forum ?)

Code: Select all

#liste aussi les boutons
import PySide2
from PySide2 import QtGui ,QtCore, QtWidgets
from PySide2.QtGui import *
from PySide2.QtCore import *

mw=Gui.getMainWindow()
dw=mw.findChildren(QtWidgets.QWidget)

# show the names of all dock windows
print(dw)

#list the button name
for i in dw:
  i.objectName()
  print(i.objectName())


mario
Last edited by mario52 on Thu Apr 02, 2020 9:37 am, edited 1 time in total.
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.
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: How to get WBs, Toolbars, Tools

Post by HakanSeven12 »

mario52 wrote: Thu Apr 02, 2020 8:43 am hi
mario
hi mario. listCommands() get all of them. I want to know which workbench contains which toolbar and which toolbar contains which tool. I'm trying to create a ribbon for freecad. so I need a hierarchical structure of them.


ribbon.png
ribbon.png (108.84 KiB) Viewed 1814 times
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: [Help] How to get WBs, Toolbars, Tools

Post by HakanSeven12 »

Bump
User avatar
johnwang
Veteran
Posts: 1345
Joined: Sun Jan 27, 2019 12:41 am

Re: [Help] How to get WBs, Toolbars, Tools

Post by johnwang »

Looking foward For this ribbon. Great.
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: [Help] How to get WBs, Toolbars, Tools

Post by HakanSeven12 »

johnwang wrote: Fri Apr 03, 2020 12:24 am Looking foward For this ribbon. Great.
Thanks 🙂 I hope I can find a way for binding.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Help] How to get WBs, Toolbars, Tools

Post by Kunda1 »

Isn't there already a horizontal ribbon-like menu ? need to dig through the forum to find it
...
Perhaps @pablogil developed it? It can be seen in this post (in the 2nd, 3rd, and 4th image attachments):
https://forum.freecadweb.org/viewtopic. ... on#p168417
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
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: [Help] How to get WBs, Toolbars, Tools

Post by HakanSeven12 »

Kunda1 wrote: Fri Apr 03, 2020 1:33 pm Isn't there already a horizontal ribbon-like menu ? need to dig through the forum to find it
...
Perhaps @pablogil developed it? It can be seen in this post (in the 2nd, 3rd, and 4th image attachments):
https://forum.freecadweb.org/viewtopic. ... on#p168417
That is tabbar its not samething :) There still toolbars and I want to show them as segment like other cad programs.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Help] How to get WBs, Toolbars, Tools

Post by Kunda1 »

HakanSeven12 wrote: Fri Apr 03, 2020 1:48 pm That is tabbar its not samething
:oops: sorry
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
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Help] How to get WBs, Toolbars, Tools

Post by Kunda1 »

What about https://github.com/triplus/SelectorToolbar ?
Perhaps it has some hints in the code that could help with this issue?
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
Post Reply