[New feature] Sketcher Constrain Contextually

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by Kunda1 »

This new feature, does it have a setting in the preferences to be enabled/disabled in the UI ? (JIC there are veteran FC users who are not interested in this workflow?)
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
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by adrianinsaval »

Kunda1 wrote: Wed Jan 26, 2022 3:38 pm This new feature, does it have a setting in the preferences to be enabled/disabled in the UI ? (JIC there are veteran FC users who are not interested in this workflow?)
It's a new command, don't want it, don't click on it, it doesn't need any preference IMO. Perhaps you meant to post this on the thread about the tool settings task widget?
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by adrianinsaval »

paddle wrote: Wed Jan 26, 2022 9:19 am I found a way to filter the keys. (in TaskSketcherTool.cpp event filter for future reference)

So we need to find which keys to filter out of the spinbox.

What shortcuts are used while creating geometries or creating constraints?
I think this would be a never ending chase, plus the shortcuts are customizable so the filtering will only work with the defaults. Perhaps it's best to have a key that switches the capture of unit letters on/off, I think if u (from unit) is not taken that's a good candidate.
Haavard
Posts: 217
Joined: Wed Feb 17, 2021 10:48 pm

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by Haavard »

paddle wrote: Space...
It looks like the switch to space caused some regressions. If i click two points then space (to cycle to coincident), i can't cycle back to distance, and the sketch starts to get toggled between hide/show..
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by Kunda1 »

adrianinsaval wrote: Wed Jan 26, 2022 5:30 pm It's a new command, don't want it, don't click on it, it doesn't need any preference IMO. Perhaps you meant to post this on the thread about the tool settings task widget?
Yes, thanks. That is what i meant.
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
Haavard
Posts: 217
Joined: Wed Feb 17, 2021 10:48 pm

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by Haavard »

Long post alert :lol:

I tried to think through what i would expect this tool to do based on the current selection, and in most cases the tool behaved basically as expexted! I have some personal preferences on how i ideally would like the tool to behave, but i can't garantee these are in any way "best" or "preferred", more like "this would feel right". I have listed these, along with the currently observed behavior in the attached PDF.

Comments:
- As said earlier, geometric constraints are preferred over dimensional, so bring back the 0° parallel and 90° perpendicular constraints for two lines please :D
- When selecting two lines, the first alternative is parallel and distance. I personally wouldn't use this very often, and because of this awesome tool, creating a distance constraints is two mouseclicks anyway..
- When selecting either three points, or two points and a line, symmetry could be applied. This would be nice to integrate, then i believe most constraint are included!
- The hints are of course very rough and inaccurate as expected for such an early version ;)

The more i use this tool, the happier i get. Hope everyone will get just a small part of this joy when they get to use this feature 8-)


------------------------------------------------------------------------------------
Further development suggestion

Disclaimer: I am a human, so of course i am biased towards the tool i use at work. This could also be a lot of work, so i am NOT asking you to develop this or anything, it's only one of many possible ways this tool can take in the future. If it were to be developed, it could be a stage two or three after the basic tool is merged.

Background: The UI/UX element i dislike the most about FreeCAD, is that every tool, no matter how rare you use it, have a button on the toolbar. And every button look almost identical, so it's often really hard to distinguish between them. When getting started i spent a lot of time searching for the correct tool, and it's tiresome. An icon combined with text on the other hand is a lot easier to find and understand.

Possible behavior: you select the "smart/fast/universal/contextual/auto" constraint tool, and the tool settings menu appear as usual. Then based on which geometry you select, the applicable constraint appear as spinboxes and buttons. You still cycle between them using shift/space, and the selected one is highlighted. They can also be clicked on with the mouse, an will feel much more interactive and easier to find than the current constraints toolbar. I made some quick drawings to show the proof of concept: (i am not advocating to remove the current tool bar! ;) )

Right click -> open image in new tab if the image appears to small.
Attachments
suggestion.png
suggestion.png (48.46 KiB) Viewed 1874 times
Universal constraint tool.pdf
(17.01 KiB) Downloaded 36 times
User avatar
paddle
Veteran
Posts: 1392
Joined: Mon Feb 03, 2020 4:47 pm

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by paddle »

Haavard wrote: Wed Jan 26, 2022 6:53 pm It looks like the switch to space caused some regressions. If i click two points then space (to cycle to coincident), i can't cycle back to distance, and the sketch starts to get toggled between hide/show..
Yes this problem is not directly related to the space key. The focus was given to the wrong view.
Edit: maybe no. Working on it.
Edit2: damn I spent my whole morning on that. There's an underlying issue when toolsettings try to goes 'off' and return focus to the mainview. So the key events get received at the wrong place.
User avatar
paddle
Veteran
Posts: 1392
Joined: Mon Feb 03, 2020 4:47 pm

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by paddle »

Haavard wrote: Wed Jan 26, 2022 10:40 pm Long post alert :lol:

I tried to think through what i would expect this tool to do based on the current selection, and in most cases the tool behaved basically as expexted! I have some personal preferences on how i ideally would like the tool to behave, but i can't garantee these are in any way "best" or "preferred", more like "this would feel right". I have listed these, along with the currently observed behavior in the attached PDF.

Comments:
- As said earlier, geometric constraints are preferred over dimensional, so bring back the 0° parallel and 90° perpendicular constraints for two lines please :D
- When selecting two lines, the first alternative is parallel and distance. I personally wouldn't use this very often, and because of this awesome tool, creating a distance constraints is two mouseclicks anyway..
- When selecting either three points, or two points and a line, symmetry could be applied. This would be nice to integrate, then i believe most constraint are included!
- The hints are of course very rough and inaccurate as expected for such an early version ;)

The more i use this tool, the happier i get. Hope everyone will get just a small part of this joy when they get to use this feature 8-)
- Ok
- My thinking was that when you make lines parellel, then you often need to set the distance too. But it might make the tool too complex.
- Could be. I'll probably add it then.
- There're a lot of them and I didn't want to spend too much time before final version.

I have been working a lot on removing the not-possible constraints. For instance if a line is already horizontal, then don't offer horizontal/vertical/lock. Though another possibility would be to replace the existing constraint. So if a line is horizontal, then alternate between vertical and lock after removing the horizontal. It could be nice but brings another layer of convolution to the code.
User avatar
paddle
Veteran
Posts: 1392
Joined: Mon Feb 03, 2020 4:47 pm

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by paddle »

Haavard wrote: Wed Jan 26, 2022 10:40 pm Further development suggestion

Possible behavior: you select the "smart/fast/universal/contextual/auto" constraint tool, and the tool settings menu appear as usual. Then based on which geometry you select, the applicable constraint appear as spinboxes and buttons. You still cycle between them using shift/space, and the selected one is highlighted. They can also be clicked on with the mouse, an will feel much more interactive and easier to find than the current constraints toolbar. I made some quick drawings to show the proof of concept: (i am not advocating to remove the current tool bar! ;) )
I really like your mockup. It's certainly more appealing than my current hints. But this requires some QT ui magic that I'm not very comfortable with.
I might do it when I run out of bug to solve or features ideas.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by adrianinsaval »

While I like Haavard's UI suggestion, this should be left for later, let's not get too ambitious and then never get it merged because it's never finished... Better to focus on the core functionality first. I'm not sure if applying symmetry with a does it all tool is really intuitive, but we can always revert if it ends up being annoying.
- My thinking was that when you make lines parellel, then you often need to set the distance too. But it might make the tool too complex.
I don't think it's often enough to justify putting that every time.
Post Reply