Associate a keyboard shortcut to a macro for all workbenches

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
Hologram
Posts: 203
Joined: Thu Nov 03, 2022 3:05 pm

Associate a keyboard shortcut to a macro for all workbenches

Post by Hologram »

Sorry if this has been asked before, but I couldn't find the answer:

Is there a way to add macros to one toolbar and make this toolbar available (read: visible) for all workbenches?
I want to add some common keyboard shortcuts for display styles (wireframe, shaded, hidden line) and various other things through macros. But how do I then make sure I can re-use this macro throughout all workbenches that I want it to?
mario52
Veteran
Posts: 4692
Joined: Wed May 16, 2012 2:13 pm

Re: Associate a keyboard shortcut to a macro for all workbenches

Post by mario52 »

Hi

Tools → Customize... → ToolBar → (WorkBench) Global

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.
Hologram
Posts: 203
Joined: Thu Nov 03, 2022 3:05 pm

Re: Associate a keyboard shortcut to a macro for all workbenches

Post by Hologram »

Hi Mario, I tried to do that, but wasn't able to find the commands in 0.20.2 for some reason.
In the 0.21 dev branch, I managed to find them and associate a hotkey to the macro.
Hologram
Posts: 203
Joined: Thu Nov 03, 2022 3:05 pm

Re: Associate a keyboard shortcut to a macro for all workbenches

Post by Hologram »

Actually, I see there is an option to set an "accelerator" in the macro. It asks for a keyboard shortcut. What is it used for?
mario52
Veteran
Posts: 4692
Joined: Wed May 16, 2012 2:13 pm

Re: Associate a keyboard shortcut to a macro for all workbenches

Post by mario52 »

Hi
Hologram wrote: Wed Jan 25, 2023 11:10 pm "accelerator" in the macro. It asks for a keyboard shortcut. What is it used for?
your keyboard shortcut for the macro, as your request (first post)

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.
Hologram
Posts: 203
Joined: Thu Nov 03, 2022 3:05 pm

Re: Associate a keyboard shortcut to a macro for all workbenches

Post by Hologram »

@mario52 I expected as much, but what's the difference between using the accelerator input box on the one hand and the create macro > add to toolbar > add keyboard shortcut process on the other hand? Does this mean I can add a shortcut to a macro and then add the button to a toolbar, effectively mitigating the step of going to the keyboard shortcuts?
mario52
Veteran
Posts: 4692
Joined: Wed May 16, 2012 2:13 pm

Re: Associate a keyboard shortcut to a macro for all workbenches

Post by mario52 »

Hi

I do not know, but you can use the shortcut or the toolBar button you can also hidden your toolBar and use only the shortCut

click right to the toolBar and search and uncheck your toolBar

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.
Post Reply