[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!
Post Reply
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: Tue Jan 25, 2022 12:00 am Just compiled and tested this PR.

Yeah. Sketcher just got a new queen. This tool is in my opinion insanely powerful, even more than polyline. Absolutely wonderful job here paddle!
Glad you like it ! :)
Haavard wrote: Tue Jan 25, 2022 12:00 am
  • It would be nice if you could just press enter without having to type '0' first, since '0.00' is the default in tool settings.
Yes, I don't know why enter doesn't work initially actually.
Haavard wrote: Tue Jan 25, 2022 12:00 am
  • When you click a first point, the tool defaults to lock (X and Y lengths). I rarely use lock, and this clutters the mouse pointer and makes it hard to select the second point. How about the default is no constraint, and you can cycle using shift, just as it works now, to lock, x and y?
Yes it's true it annoyingly clutters the mouse pointer. Rather than putting default as no constraint, I was thinking about moving the constraints a little bit on the side as to not clutter the mouse pointer. But I need to find a way to move the constraint consistently on the side. Because using just +5 (mm) in the move is not consistent and looks good only in one zoom position. It needs to be relative to the screen width.
Haavard wrote: Tue Jan 25, 2022 12:00 am
  • This tool is so powerful it could be a bit difficult to learn all the features by testing. It would be cool with a hint somewhere, perhaps above the numbers in Tool settings. For example, you click two lines, and get asked to input angle. Then the hint could say "Input 0 ° for parallel, or 90 ° for perpendicular constraint". Or even better, if you could press shift so cycle between angle, parallel, perpendicular and tangent..?
Yes it's a reason why I hesitate to make the alternate constraint with shift. Because if it becomes to complex it loose the advantage of being intuitive.
And yes you are right, the hint could be displayed in the tool settings. I tried to put some hints in the cursor text but it's not really good.
Haavard wrote: Tue Jan 25, 2022 12:00 am
  • Is there a need to accept letters in the number box? It already displays the default document units. Because of this keyboard shortcuts does not work when creating geometry, and i often like to switch between normal and construction geometry using a shortcut when sketching. This way those preferring M for polyline would not have an issue.
I didn't knew of other shortcuts that were usefull when a tool is active so I have not seen this issue. The box need to catch the letters because user can delete the unit, also he needs to be able to change it. Though I could perhaps set the unit as none and prevent the box from catching any letters. Alternatively some letters could not be caught by the spinbox. It really needs only few letters for the different units.
Haavard wrote: Tue Jan 25, 2022 12:00 am
  • Could double clicking be used? Say i want to constrain two points witch coincident. Now i click the first, then the second, input 0, then enter. It would be nice to click the first, then doubleclick the second to apply coincident. Also if i press a line, and would like to make it equal to another line, i could doubleclick the second line, sort of like if i was clicking on three lines. And you could create coincident constraint on multiple points this way, by clicking on many points and doubleclicking the last point.
It is possible. It feels like a good idea, but I'm afraid that if there are too many ways to change the type of constraints, then the intuitiveness of the tool might be lost.
Equality of the two lines could be done with the shift key too.
Haavard wrote: Tue Jan 25, 2022 12:00 am
  • When creating geometry, if 0mm x or y is input, it is probably better to use coincident or point-on-object instead of 0mm distance. Either coincident to origin if both is 0, or point on object to one axis if one is zero.
It would look cleaner indeed. Though the advantage of the 0mm distance is that it can be edited easily. Are there advantages to have coincident/pointonobject rather than the distance=0 ? Rather than just looking better.
Haavard wrote: Tue Jan 25, 2022 12:00 am
  • The name and icon could definitely be better. I know "Smart constraint" it perhaps a bit disliked by some, but maybe something similar? It would at least be fitting for this tool. "Contextual Constraint" would tell me absolutely nothing if i didn't know about it beforehand. Super constrain? Multi constrain? Genius constrain? Any other ideas?
Hmm I thought Contextual was OK but yes it's not a super-seller. Smart Constraint sucks apparantly even though I think it conveys the meaning pretty well IMO. I was thinking about "Auto Constrain" but in the backend there is a thing called auto-constrain so it felt misleading to use that name. Though if this name is used only in the UI ?
Haavard wrote: Tue Jan 25, 2022 12:00 am
  • Creating a new settings block in Preferences -> Sketcher is probably needed. When people begin to use this i guess many will have their own preferences between tool cycling, default settings e.g. And even if i think the auto radius/diameter should be default for curves, it would be nice to have it as an option in settings for those who disagree.
A setting in preferences would be good indeed. Also it could allow further customization of the tool. But it needs more explorative work as I don't know how to make preferences settings. And I have other things I want to work on first (distance for circles, scaling and rotating, CTRL-C CTRL-V).
Maybe you can give it a go?
Haavard wrote: Tue Jan 25, 2022 12:00 am These are only suggestions, not criticism :)
Those are great. It helps going further towards merging a well thought/debugged tool. The distance idea you posted at the beginning is particularly awesome in my opinion.
Grub
Posts: 303
Joined: Sun Nov 15, 2020 7:28 pm

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by Grub »

paddle wrote: Tue Jan 25, 2022 10:34 am Hmm I thought Contextual was OK but yes it's not a super-seller. Smart Constraint sucks apparantly even though I think it conveys the meaning pretty well IMO. I was thinking about "Auto Constrain" but in the backend there is a thing called auto-constrain so it felt misleading to use that name. Though if this name is used only in the UI ?
"Fast Constraints" :?:
User avatar
NewJoker
Veteran
Posts: 3017
Joined: Sun Oct 11, 2020 7:49 pm

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by NewJoker »

paddle wrote: Tue Jan 25, 2022 10:34 am Hmm I thought Contextual was OK but yes it's not a super-seller. Smart Constraint sucks apparantly even though I think it conveys the meaning pretty well IMO. I was thinking about "Auto Constrain" but in the backend there is a thing called auto-constrain so it felt misleading to use that name. Though if this name is used only in the UI ?
Adaptive Constraint ?

This feature is really a game changer for me, it’s awesome that you added it.

By the way, do you plan to continue working on the other large new feature - sketcher tool settings ? It would be awesome to have it added to FreeCAD.
User avatar
paddle
Veteran
Posts: 1392
Joined: Mon Feb 03, 2020 4:47 pm

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by paddle »

NewJoker wrote: Tue Jan 25, 2022 12:36 pm Adaptive Constraint ?

This feature is really a game changer for me, it’s awesome that you added it.

By the way, do you plan to continue working on the other large new feature - sketcher tool settings ? It would be awesome to have it added to FreeCAD.
Glad to hear it!
Constrain Contextually actually build on top of tool settings as it requires it. So yes.
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by carlopav »

I'd also like to express that i'd really welcome such a tool!
follow my experiments on BIM modelling for architecture design
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: Mon Jan 24, 2022 5:53 pm It's because of the way the tool works. It actually creates the constraint at every step. Then delete and recreate the constraints on each steps. And if the tool abort (right click) then it delete the last seen constraint.
So the vertical/horizontal would get applied (as the equality for 2+ circles is which is not ideal) and the geometry would update to be vertical/horizontal. Even if the tool abort and the constraint is deleted the geometry would have moved.
Or I need a way to cancel (ctrl-z not just delete) the vertical/horizontal constraint. Is that possible from the code?
But horizontal/vertical distance don't change geometry, horizontal and vertical constraints do but setting the horizontal distance between two points doesn't require them to be horizontally constrained.
Attachments
Captura de pantalla 2022-01-25 100909.png
Captura de pantalla 2022-01-25 100909.png (22.52 KiB) Viewed 3324 times
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by adrianinsaval »

Grub wrote: Tue Jan 25, 2022 11:04 am "Fast Constraints" :?:
I think the word Quick is more often used for this type of things but not being native I'm not sure of the difference or if it really matters at all. But I agree with the idea.
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: Tue Jan 25, 2022 10:34 am I didn't knew of other shortcuts that were usefull when a tool is active so I have not seen this issue. The box need to catch the letters because user can delete the unit, also he needs to be able to change it. Though I could perhaps set the unit as none and prevent the box from catching any letters. Alternatively some letters could not be caught by the spinbox. It really needs only few letters for the different units.
perhaps it can be made to only catch letters when the user clicks on the spinbox so we don't have to worry about shortcuts.
It would look cleaner indeed. Though the advantage of the 0mm distance is that it can be edited easily. Are there advantages to have coincident/pointonobject rather than the distance=0 ? Rather than just looking better.
Yes, as was said before geometrical constraints are always preferred over dimensional because the solver handles it much better. I think there's been issues before were setting a distance of 0 caused problems when trying to use the sketch in operations because the points weren't actually coincident, but just close enough to 0 distance to be within the solver's tolerance, abdullah or chrisb would likely know better than me about this.
User avatar
paddle
Veteran
Posts: 1392
Joined: Mon Feb 03, 2020 4:47 pm

Re: NEW FEATURE ! Sketcher Constrain Contextually

Post by paddle »

adrianinsaval wrote: Tue Jan 25, 2022 1:10 pm But horizontal/vertical distance don't change geometry, horizontal and vertical constraints do but setting the horizontal distance between two points doesn't require them to be horizontally constrained.
The distanceX and DistanceY can already alternate depending on the mouse position as haavard asked in the first page (see video : https://www.youtube.com/watch?v=J7khOBh ... ADDevDiary)

So for the single line, the idea was to change between distance (or distanceX/distanceY depending on mouse position) and Horizontal and Vertical.
carlopav wrote: Tue Jan 25, 2022 12:58 pm I'd also like to express that i'd really welcome such a tool!
Thanks !
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: Tue Jan 25, 2022 1:35 pm The distanceX and DistanceY can already alternate depending on the mouse position as haavard asked in the first page (see video : https://www.youtube.com/watch?v=J7khOBh ... ADDevDiary)
Niiiice, I didn't see that so i thought you were still having trouble changing from distance to dsitanceX/disntanceY
Post Reply