Sketcher: drive the intent in slot creation

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!
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketcher: drive the intent in slot creation

Post by openBrain »

Would like to hear from the community.
Maybe it's a better solution that if 'Auto-constraints' is enabled, the slot will be constrained horizontal/vertical if it's drawn close to it (basically same as a line).
freedman
Veteran
Posts: 3441
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Sketcher: drive the intent in slot creation

Post by freedman »

openBrain wrote: Thu Nov 25, 2021 5:01 pm Would like to hear from the community.
Maybe it's a better solution that if 'Auto-constraints' is enabled, the slot will be constrained horizontal/vertical if it's drawn close to it (basically same as a line).
I think that's perfect, easy to do, easy to document.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Sketcher: drive the intent in slot creation

Post by adrianinsaval »

+1
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketcher: drive the intent in slot creation

Post by openBrain »

Actually both things aren't exclusive. I'll let the current PR as it is and will create a new one for above feature.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher: drive the intent in slot creation

Post by chrisb »

openBrain wrote: Thu Nov 25, 2021 6:44 pm Actually both things aren't exclusive. I'll let the current PR as it is and will create a new one for above feature.
Sounds good!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketcher: drive the intent in slot creation

Post by openBrain »

openBrain wrote: Thu Nov 25, 2021 6:44 pm Actually both things aren't exclusive. I'll let the current PR as it is and will create a new one for above feature.
OK, I updated the PR so both "snapping with Ctrl key" and "Autoconstraining horizontal/vertical" are implemented.
It would be interesting though to have some community feedback as there are some subtle details. I'll try to describe things as clear as possible.

A thing you may ignore but that is important to know in this case is that when you use 'Auto-constraint', sketching a geometry actually consists of 2 transactions (transaction = undoable action):
1-> Geometry (it can be a complex one, such as the slot) is added without auto constraints
2-> Constraints suggested by 'Auto-constraint' are added

So now, what happens today in the PR and that I'd like feedback about.

CTRL key not pressed, Auto-constraint disabled
No change. Slot is created without extra constraints. Only one transaction.

CTRL key pressed, Auto-constraint disabled
Slot is imperatively drawn horizontal/vertical. An extra horizontal/vertical constraint is added "as part of the slot" => Only one transaction

CTRL key not pressed, Auto-constraint enabled
Slot is drawn as defined by user clicks without extra constraints.
Then the auto constraints are added, including the potential horizontal/vertical one => Two transactions (only one if no auto constraint)

CTRL key pressed, Auto-constraint enabled
Slot is imperatively drawn horizontal/vertical. An extra horizontal/vertical constraint is added "as part of the slot".
Then the auto constraints are added, except the potential horizontal/vertical one that is disregarded if necessary => Two transactions (only one if no auto constraints)

Roughly, you can consider that the horizontal/vertical constraint caused by snapping is "eating" the one caused by 'Auto constraint' if both exists.
Moreover this constraint is added in "geometry creation step" if caused by snapping, while added in "auto constraining step" if caused by 'Auto constraint'.

Hope I made this clear. Any feedback welcome.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher: drive the intent in slot creation

Post by chrisb »

I don't see any problems with two commits. It may even be desired, if the auto constraint is added accidentally. Concerning the latter: is there a preview for the autoconstraint like we see it e.g. for a horizontal line?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketcher: drive the intent in slot creation

Post by openBrain »

chrisb wrote: Fri Nov 26, 2021 4:35 pm I don't see any problems with two commits. It may even be desired, if the auto constraint is added accidentally.
I find this OK too. And that wasn't the purpose to discuss it here. ;)
I just want to denote that depending if you snap or auto-constrain, the horizontal/vertical constraint won't be added at the same transaction (respectively first "geometry creation", and second "auto constraint creation").
Concerning the latter: is there a preview for the autoconstraint like we see it e.g. for a horizontal line?
Yes. I didn't provide detail or screencast, but indeed when 'Auto constraint' is enabled, you'll see a horizontal/vertical sign beside the cursor when applicable. ;)
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher: drive the intent in slot creation

Post by chrisb »

openBrain wrote: Fri Nov 26, 2021 4:40 pm Yes. I didn't provide detail or screencast, but indeed when 'Auto constraint' is enabled, you'll see a horizontal/vertical sign beside the cursor when applicable. ;)
Top!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketcher: drive the intent in slot creation

Post by openBrain »

Merged by @abdullah. Feel free to complain if don't like the feature. :lol:
Post Reply