Why does FC use consecutive keystroke shortcuts ?

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
<Charlie_root>
Posts: 53
Joined: Mon Aug 12, 2019 8:01 pm
Contact:

Why does FC use consecutive keystroke shortcuts ?

Post by <Charlie_root> »

I've been wondering about this for a while and since I haven't found a discussion about this anywhere, here it is:

Why does FreeCAD use consecutive keystrokes for it's shortcuts rather than parralel shortcuts ?

I'm sure there must be a reason

It may be just me but some of them never work like for example in the Sketcher, if you want to trim an edge, the shortcut is T, R ... which is funny because if you press T it tries to add a Tangency constraint, and then after you press R it tries to add a rectangle.

why not just avoid this altogether by having the shortcuts be good'ol T+R and then you can have all 3 activation cases be possible ?

I mean as a Blender user I rely very much on shortcuts as they speed up the workflow considerably. hitting a button or combination of buttons on your keyboard will always be faster than moving your mouse to the thing you want. it also drives away focus. if you've decided to do something to a particular thing you've already pointed the cursor to it ... having to unnecessarily "abandon" it till you find a button to press and then come back to it is a huge pain.
sure, you can select it and then hit the button, but that doesn't work with everything like the Fillet in the sketcher (thankfully the F shortcut works in that case)
RETRIBUTION IS AT HAND
chrisb
Veteran
Posts: 54150
Joined: Tue Mar 17, 2015 9:14 am

Re: Why does FC use consecutive keystroke shortcuts ?

Post by chrisb »

<Charlie_root> wrote: Wed Jul 15, 2020 1:04 pm why not just avoid this altogether by having the shortcuts be good'ol T+R and then you can have all 3 activation cases be possible ?
I'm not sure if this would work. You almost never will hit both keys at the same time. In your example hitting the T may immediately have created a tangency constraint; if you add R what should happen? Should the tangency be removed?

The issue is a different one: The set of keyboard abbreviations doesn't satisfy the so called Fano condition, which requires that no valid code (here: no complete shortcut key sequence) is a prefix of some other valid code. This condition doesn't hold for the Sketcher shortcuts, where the T is itself a valid shortcut, while it is at the same time a prefix of the sequence T+F.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
wmayer
Founder
Posts: 20298
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Why does FC use consecutive keystroke shortcuts ?

Post by wmayer »

<Charlie_root> wrote: Wed Jul 15, 2020 1:04 pm Why does FreeCAD use consecutive keystrokes for it's shortcuts rather than parallel shortcuts ?
The discussion started here: https://forum.freecadweb.org/viewtopic.php?f=8&t=896
See also: https://doc.qt.io/archives/qt-4.8/qkeys ... -sequences
It may be just me but some of them never work like for example in the Sketcher, if you want to trim an edge, the shortcut is T, R ... which is funny because if you press T it tries to add a Tangency constraint, and then after you press R it tries to add a rectangle.
This is a bug in the Sketcher code IMO. A letter that is part of an Emacs-style shortcut cannot be used as a single-letter shortcut.
User avatar
<Charlie_root>
Posts: 53
Joined: Mon Aug 12, 2019 8:01 pm
Contact:

Re: Why does FC use consecutive keystroke shortcuts ?

Post by <Charlie_root> »

simple solution: only evaluate shortcuts after every key is released

you would implement this with a stack: store every key that's being pressed, remove every key that's being released after a short cooldown of like 1 second, and if all keys are released before that cooldown expires, just APPLY everything that was inside the stack. press T, release T > BAM, tangency is applied

press T, press, R, release both, BAM, Trim tool active

simple as that
RETRIBUTION IS AT HAND
chrisb
Veteran
Posts: 54150
Joined: Tue Mar 17, 2015 9:14 am

Re: Why does FC use consecutive keystroke shortcuts ?

Post by chrisb »

<Charlie_root> wrote: Wed Jul 15, 2020 6:31 pm simple as that
Very glad to hear a fix is in the queue!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Why does FC use consecutive keystroke shortcuts ?

Post by DeepSOIC »

<Charlie_root> wrote: Wed Jul 15, 2020 6:31 pm press T, press R, release both, BAM, Trim tool active
Interesting idea, though I don't think the "cooldown" thing is necessary. A similar thing is there in navigation styles with mouse buttons, why not apply it to keyboard.
User avatar
<Charlie_root>
Posts: 53
Joined: Mon Aug 12, 2019 8:01 pm
Contact:

Re: Why does FC use consecutive keystroke shortcuts ?

Post by <Charlie_root> »

DeepSOIC wrote: Wed Jul 15, 2020 11:04 pm though I don't think the "cooldown" thing is necessary.
that's optional, indeed, is just a subtle UX improvement ... it's just there encase people press the keys half-consecutivley ... like you're playing the piano : you release the first key while you move your finger to press the second, but this all happens really fast ... removing a key from the stack immediatley after release would make it a bit harder to use the shortcuts fast with one hand.
wmayer wrote: Wed Jul 15, 2020 3:10 pm This is a bug in the Sketcher code IMO. A letter that is part of an Emacs-style shortcut cannot be used as a single-letter shortcut.
Ok so since the shortcuts are busted anyway and we have no shortcut for diameter/radius can we PLEEEEASE just rip-off Solvespace's sketcher shortcuts ?

S - draw Segment
L - draw Polyline
C - draw Circle
A - draw Circle Arc
R - draw rectangle
B - draw bezier spline
F - fillet

D - Distance AND Diameter
N - angle
U - switches angle constraint between 2 lines to supplementary
P - Parallel AND Tangent
Shift+P - Perpendicular
Q - Equal
O - (OVERLAP) which is both Coincident AND Point on Line
Y - symmetry
H,V - horiz/vertical

ok so that was not exactly SLVS's control scheme, it's a bit different and there may be some collisions with existing FC shortcuts I do not know, but if anything, the most important and single best shortcut of them all in Solvespace is the O and the D.
So depending on the selection context it applies either a coincident point or a point-on-line (and even plane cause slvs can sketch in 3d but that's beside the point) and a distance/diameter respectivley
those make Solvespace just So FAST it's a joy to use
RETRIBUTION IS AT HAND
chrisb
Veteran
Posts: 54150
Joined: Tue Mar 17, 2015 9:14 am

Re: Why does FC use consecutive keystroke shortcuts ?

Post by chrisb »

<Charlie_root> wrote: Thu Jul 16, 2020 1:49 am U - switches angle constraint between 2 lines to supplementary
...
P - Parallel AND Tangent
How would you decide which one to apply? O would be ambigious in tool-first mode. Furthermore I miss radius and horizontal and vertical distance.
I have no idea what U should do.

I would follow a different but very clear paradigm:
- no modifier for geometric constraints; from my experience they are used most often
- Shift for dimensions. They are already used for horizontal and vertical dimensions, and the additional effort is justifiable, as they should be minimized anyway
- Alt for geometric elements

Alt+L - draw Line
Alt+A - draw Circle Arc (mode should be the last selected)
Alt+C - draw Circle (mode should be the last selected)
Alt+B - draw bezier spline (mode should be the last selected)
Alt+P - draw Polyline
Alt+R - draw Rectangle
Alt+S - Slot
Alt+F - Fillet
Alt+E - External
Alt+T - Toggle construction mode
(Should be discussed if all of these are needed)

C - Coincident
O - Point on Line
V - Vertical
H - Horizontal
P - Parallel
N - Normal
T - Tangent
E - Equal
S - Symmetry

Shift+H - Horizontal distance
Shift+V - Vertical distance
Shift+L - Length
Shift+R - Radius
Shift+D - Diameter
Shift+A - Angle

You could allow additional single keys for dimensions and elements if they are unique, but they should always work with the modifiers.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Why does FC use consecutive keystroke shortcuts ?

Post by openBrain »

Guys, I welcome your participation to this initiative. ;)
chrisb
Veteran
Posts: 54150
Joined: Tue Mar 17, 2015 9:14 am

Re: Why does FC use consecutive keystroke shortcuts ?

Post by chrisb »

openBrain wrote: Thu Jul 16, 2020 6:46 am Guys, I welcome your participation to this initiative. ;)
I'M not sure how to proceed. I don't think it is appropriate to merge both topics, as this topic is dedicated to sketcher.

As I spend most time in Sketcher and especially applying constraints, I need the shortcuts there most of the time, but you are of course right, that a sound overall concept should be the final goal.
Usually I prefer a top down approach, but in this case, where we have already a usable (sub)set of working and accepted shortkeys for sketcher we may rather optimize it and then generalize it.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply