Menu System Enhancement

A forum for research and development of the user interface of FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Menu System Enhancement

Post by realthunder »

I have made some enhancement on FreeCAD menu system. You can try the new features using my latest pre-built image here.

I know there is the excellent Pie Menu add-on from triplus. My improvement on the menu system here is not about visual aspect of the UI(Pie menu style has just been added), but rather, the usability aspect. The idea is to make it trivial for user to create his own menus that can be easily recalled using a keyboard shortcut. These menus can greatly reduce the need for toolbars and free up more work space for 3D view.

The improvement starts with a powerful new command called 'Std_CmdHistory', which offers a context menu that can be brought up using keyboard shortcut 'R, R' (R stands for Recent in case you wonder). This menu holds the recently clicked toolbar/menu actions. You can control the maximum number of items with 'Preference -> General -> Command history size'.
Screenshot from 2020-07-15 18-34-12.png
Screenshot from 2020-07-15 18-34-12.png (7.36 KiB) Viewed 6132 times

One of the powerful features of this menu is that you can search for commands by simply typing any keyword you can remember from the command's menu text. Be aware that some command actions has menu shortcut built-in (e.g. the underscored 'N' in New command in the above picture), which may interfere with direct typing. Just click the typing area or press spacebar to activate search mode. Use Tab and Shift + Tab to navigate through the found commands. Press Enter to activate the command, which will also be remembered in the recent commands list.
command-search.gif
command-search.gif (119.81 KiB) Viewed 6132 times

Now, here comes the key feature, to create your own personalized menu. Simply click the 'Add toolbar...' menu action, and it will jump to 'Customized -> Toolbar' dialog, and prompt for a name of the toolbar. After confirmation, you'll have a new global toolbar right away. But we want a menu instead. Simply uncheck the toolbar item (to hide the toolbar), and assign a shortcut. Done! You can now bring up the menu using keyboard shortcut.
create-menu.gif
create-menu.gif (273.11 KiB) Viewed 6132 times

You can of course directly use the 'Customize -> Toolbars' dialog to create your menu. Remember that only 'Global' toolbar support shortcut at the moment. You need to select a toolbar before the shortcut edit controls are shown. You can also search for command by typing, similar to Std_CmdHistory.
Screenshot from 2020-07-15 19-41-56.png
Screenshot from 2020-07-15 19-41-56.png (73.88 KiB) Viewed 6132 times
Last edited by realthunder on Sat Jul 25, 2020 5:41 am, edited 1 time in total.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Menu System Enhancement

Post by realthunder »

I have also added two useful commands that can be accessed as menu.

Shortcut 'G, G' to bring up the 'Pick geometry' menu, which allows you to select higher order geometry features under the mouse cursor. This menu action is previously available through normal right click menu. It is now available through keyboard shortcut for more convenience.
pick-geometry.gif.gif
pick-geometry.gif.gif (153.29 KiB) Viewed 6123 times

Shortcut 'U, U' to bring up the object hierarchy menu. Users working with highly nested hierarchical objects (e.g. assemblies) will find this menu extremely handy. It extracts object hierarchy information from the tree view, and offers an extra dimension to navigate up or down. Simply press the shortcut with your mouse cursor under either a tree view item, or an object in 3D view. A menu will popup showing the the current object hierarchy. If there is no object under the cursor, the last browsed hierarchy will be shown. The hierarchy is remembered internally, so that you can easily navigate up and down the same hierarchy. A triangle will be shown to mark the current selected object in the hierarchy. Holding CTRL key while selecting allows you to select more than one object in the same hierarchy. Supported operations are,

Left click the menu item to select the object
Right click to show children of the object, works for grandchildren as well
Shift + Left click to edit the object, equivalent to double click the object item in tree view.
Shift + Right click to show the object's edit menu.
sel-up.gif
sel-up.gif (633.49 KiB) Viewed 6123 times
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Menu System Enhancement

Post by vocx »

realthunder wrote: Wed Jul 15, 2020 12:30 pm ...
... which offers a context menu that can be brought up using keyboard shortcut 'R, R' (R stands for Recent in case you wonder).
Sorry to hijack this thread but I wanted to know if you have investigated the behavior of keyboard shortcuts with detail to make sure everything works in a consistent manner.

It has been brought up several times in different threads, the latest of which is this: Why does FC use consecutive keystroke shortcuts ?

As pointed there, many shortcuts in FreeCAD seem to allow overlapping ones on top of others. Moreover, individual workbenches' commands also define their own shortcuts, so I am wondering, what is the proper way of dealing with them? Are there precedence rules that allow controlling the shortcuts? Should there be a list of global shortcuts that are provided by the base system (Std commands)? Should these be immutable, not available to be overridden? Are shortcuts handled differently if the pointer or focus is on the toolbar area, the tree view, the 3D view, the report view, etc?

It seems many people would like to have the flexibility of using shortcuts to select their desired tools, but this doesn't seem to work perfectly in all situations. For example, these shortcuts that you mention in these thread, are they meant to be used in all workbenches? Are they tied to the 3D view? Are they specific to the PartDesign Workbench? Can they be changed or overwritten? How do you handle that nobody will overwrite them?

I think the use of shortcuts is one of those things that could be improved in order to really improve the overall usability of the software, but it needs to be handled in a more coherent way.

See also an old thread: double-key shortcuts
And new thread: [Volunteers welcome] Refactoring the keyboard shortcuts
Last edited by vocx on Thu Jul 16, 2020 3:09 pm, edited 1 time in total.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Menu System Enhancement

Post by realthunder »

vocx wrote: Wed Jul 15, 2020 3:21 pm I think the use of shortcuts is one of those things that could be improved in order to really improve the overall usability of the software, but it needs to be handled in a more coherent way.
But FreeCAD already allows customization for keyboard shortcuts. Almost all shortcuts are user definable. The workbench author can specify default shortcuts, but that's only a suggestion and can be override or removed by user. And there will be warning and error message if the user tries to assign occupied shortcuts. A keyboard shortcut is active if a visible widget (toolbar button, menu, etc) contains an action/command with that shortcut.
Screenshot from 2020-07-16 05-48-24.png
Screenshot from 2020-07-16 05-48-24.png (51.12 KiB) Viewed 6009 times
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Menu System Enhancement

Post by vocx »

realthunder wrote: Wed Jul 15, 2020 9:56 pm ... But FreeCAD already allows customization for keyboard shortcuts. ...
I know this. What I mean is that maybe we should make a list of all shortcuts that are absolutely not allowed to be overwritten, so that the workbench author doesn't try overriding them, and so that we have a consistent behavior across all workbenches, particularly in things like selection, or highlighting, and maybe other cases, for example, move/translate/transform.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Menu System Enhancement

Post by realthunder »

vocx wrote: Wed Jul 15, 2020 10:12 pm I know this. What I mean is that maybe we should make a list of all shortcuts that are absolutely not allowed to be overwritten, so that the workbench author doesn't try overriding them, and so that we have a consistent behavior across all workbenches, particularly in things like selection, or highlighting, and maybe other cases, for example, move/translate/transform.
I don't think that's possible or necessary. We just need to make sure that everything come with FreeCAD source tree have coherent default shortcuts. We can't really control how external workbench assigns shortcuts, considering the openness of FreeCAD, and the fact that Qt/PySide allows to easily override shortcuts by script.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Menu System Enhancement

Post by carlopav »

just tried it, it's a great improvement on usability, and I like it a lot also because it allows the user to better discover how Part::Shape works, making explicit what the subelements are!!

Do you think the context menu can be polished a bit? To me it's just too long: do you feel the same?
follow my experiments on BIM modelling for architecture design
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Menu System Enhancement

Post by realthunder »

carlopav wrote: Fri Jul 17, 2020 12:56 pm Do you think the context menu can be polished a bit? To me it's just too long: do you feel the same?
You mean the default right click menu? 3D context or treeview context? I myself do find them both a bit too long, and not all actions are really useful. But that's just me, I can't decide for all users, so I come up with this enhancement to make it easy for user to create personalized menus.

It is probably a good idea to allow user to customize default context menu as well. But that's not easily done, because there is no 'one' default context menu. Each workbench chooses their own context.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Menu System Enhancement

Post by carlopav »

realthunder wrote: Fri Jul 17, 2020 1:56 pm You mean the default right click menu?
Yes. Ok! What you show here is indeed a big improvement.
It is probably a good idea to allow user to customize default context menu as well. But that's not easily done, because there is no 'one' default context menu. Each workbench chooses their own context.
Sure you are right... it just seemed to me that each workbench share the same base right click menu and add it's own actions to it, and I never used almost any of those actions :) But it's perfectly fine like this :)
follow my experiments on BIM modelling for architecture design
User avatar
OficineRobotica
Posts: 433
Joined: Thu Feb 21, 2019 8:17 am
Contact:

Re: Menu System Enhancement

Post by OficineRobotica »

After giving it a spin I find the U, U menu just brilliant. It is one of those hidden gems that needs more publicizing. It is allot easier to just point the mouse in the 3d view and see the hierarchy instead of continuously scrolling the tree collapsing and expanding one million voices.

I also use allot the G,G menu being allot more immediate than the right click-> pick geometries. A couple of observations.

The pick geometry menu will pop up just under the mouse blocking allot of times the view of the geometry. It would be nice if initially the voices [Edge][Face][Shell][Solid][Wire] would pop up in the form of a pie thus clearing the view centered around the mouse. Also, the 5 voices should always be present. Edge and wire are not present if the mouse is not dead center over a edge.

In the screenshot below I would like to have an extra menu step after (example) [Face] with the name of the genitor body of the feature. In this example it would be nice to have the menu like [Face]->[UsbPort003]->[Chamfer002(Face3)] . Or better off replace the feature name with the name of the containing body like [Face]->[UsbPort003(Face3)].
menu.jpeg
menu.jpeg (252.52 KiB) Viewed 5718 times
I really dig the workflow enhancements. Thank you so much.
Cheers
Check out my Youtube channel at: https://www.youtube.com/@OficineRobotica
Post Reply