Sketcher: drive the intent in slot creation
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
Re: Sketcher: drive the intent in slot creation
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).
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).
Re: Sketcher: drive the intent in slot creation
I think that's perfect, easy to do, easy to document.
- adrianinsaval
- Veteran
- Posts: 5548
- Joined: Thu Apr 05, 2018 5:15 pm
Re: Sketcher: drive the intent in slot creation
Actually both things aren't exclusive. I'll let the current PR as it is and will create a new one for above feature.
Re: Sketcher: drive the intent in slot creation
Sounds good!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Sketcher: drive the intent in slot creation
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.
Re: Sketcher: drive the intent in slot creation
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.
Re: Sketcher: drive the intent in slot creation
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").
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.Concerning the latter: is there a preview for the autoconstraint like we see it e.g. for a horizontal line?
Re: Sketcher: drive the intent in slot creation
Top!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Sketcher: drive the intent in slot creation
Merged by @abdullah. Feel free to complain if don't like the feature.