Sketcher: Deactivate constraints

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: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketcher: Deactivate constraints

Post by openBrain »

abdullah wrote: Mon Jun 24, 2019 12:15 pm
chrisb wrote: Sun Jun 23, 2019 8:52 am
Use case:
I recommend to place the geometric elements as near as possible to their final destination. Alas sometimes this is rather difficult. If arcs are involved it is often almost impossible to move them to an appropriate position, because they either don't move at all or they do very fancy things with flipping around.
A solution is to lock one or two points, adjust the arc and remove the dimensional constraints again.
We could start by defining examples of such controlled movements, and try to see if we can define some points to fix, for example, select some points (to be locked) before starting the dragging (some kind of giving a context to the dragging operation so that it can now what you want).
Sometimes I wonder if this couldn't be solved by "just" changing the behavior when an arc is moved. Eg. when you move the center of an arc, try to preserve the sector angle rather than "the current something" (can't determine it ATM). ;)
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Sketcher: Deactivate constraints

Post by DeepSOIC »

chrisb wrote: Sun Jun 23, 2019 8:52 am these helper … for moving stuff around
I actually have an idea about how to do that elegantly. Dragging stuff does not change selection, so selection can act as a gentle lock constraint.

Like so for example:
* if I drag a non-selected thing, all the selected elements are locked in place
* if I drag one of the selected things, FreeCAD tries to drag all the selected elements as one.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Deactivate constraints

Post by abdullah »

openBrain wrote: Mon Jun 24, 2019 12:34 pm Sometimes I wonder if this couldn't be solved by "just" changing the behavior when an arc is moved. Eg. when you move the center of an arc, try to preserve the sector angle rather than "the current something" (can't determine it ATM). ;)
DeepSOIC wrote: Mon Jun 24, 2019 1:24 pm I actually have an idea about how to do that elegantly. Dragging stuff does not change selection, so selection can act as a gentle lock constraint.

Like so for example:
* if I drag a non-selected thing, all the selected elements are locked in place
* if I drag one of the selected things, FreeCAD tries to drag all the selected elements as one.
Yup, something like this I had in mind.

Basically, we can start by one geometry, for example, the arc of circle that seems to be one of the naughty ones.

First, how should we move it without context (with nothing selected) when dragging: a) the start point, b) the end point, c) the center point.

Second, do we need a different behaviour? If yes we can try something with context, such as DeepSOIC's idea.

I do not fully understand DeepSOIC's idea with respect to the edge selected or not and edge dragging. I think I understand it when "elements" are points. For points there is a gotcha. Care should be taken when programming as when the position of a point is selected and there is a coincidence constraint, the constraint is selected instead. I am not sure if this point selecting will drive users crazy, as many, I guess, are used to select and the drag.

So, DeepSOIC's idea for points is (correct me if wrong):

1. If all points selected (arc of circle), dragging by edge nothing moves.
2. If all points selected (arc of circle), dragging one point makes all points move as a whole.
3. If start point selected (arc of circle), dragging the start point makes all move as a whole.
4. If end point selected (arc of circle), dragging the start point makes the endpoint to be fixed at the given position and the rest tries to follow the movement of the start point (as if one had a coincidence constraint between the point and the mouse).

What do you think?
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Sketcher: Deactivate constraints

Post by DeepSOIC »

abdullah wrote: Mon Jun 24, 2019 3:03 pm . If start point selected (arc of circle), dragging the start point makes all move as a whole.
No. Instead, it should behave the way it does now, as if nothing is selected.

abdullah wrote: Mon Jun 24, 2019 3:03 pm I do not fully understand DeepSOIC's idea with respect to the edge selected or not and edge dragging.
Neither do I. Just ignore selection of edges altogether for beginning, maybe.
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Sketcher: Deactivate constraints

Post by microelly2 »

Nice idea to have a tool to deactivate non datum constraints. I see a use case that I can activate the constraints in a wished order.
Maybe this can be used to implement basinhopping strategies (https://docs.scipy.org/doc/scipy/refere ... pping.html)
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketcher: Deactivate constraints

Post by openBrain »

abdullah wrote: Mon Jun 24, 2019 3:03 pm Basically, we can start by one geometry, for example, the arc of circle that seems to be one of the naughty ones.
Let's try. Define the basics :
arc.png
arc.png (10.84 KiB) Viewed 715 times
Arc is defined with :
  • Center position (CP) : =(10,10) mm in the example
  • Radius (R) : =20 mm in the example)
  • Base/middle angle (BA) : =15+60/2 = 45 ° in the example
  • Sector angle (SA) : =60 ° in the example
At now I'll consider that a "normal" user don't make the difference between the start point & the end point.
What I want to change by order of priority when I move :
  • Curve : R > BA > CP > SA
  • Center point : CP > R > BA > SA
  • Endpoint (any) : SA > BA > R > CP
This a first throw. I'm even not sure this is fully correct, but I hope it's understandable. ;)
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketcher: Deactivate constraints

Post by openBrain »

DeepSOIC wrote: Mon Jun 24, 2019 3:11 pm
abdullah wrote: Mon Jun 24, 2019 3:03 pm I do not fully understand DeepSOIC's idea
Neither do I.
:lol: :lol: :lol: Made my day :P
chrisb
Veteran
Posts: 54197
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher: Deactivate constraints

Post by chrisb »

abdullah wrote: Mon Jun 24, 2019 3:03 pm 1. If all points selected (arc of circle), dragging by edge nothing moves.
2. If all points selected (arc of circle), dragging one point makes all points move as a whole.
3. If start point selected (arc of circle), dragging the start point makes all move as a whole.
4. If end point selected (arc of circle), dragging the start point makes the endpoint to be fixed at the given position and the rest tries to follow the movement of the start point (as if one had a coincidence constraint between the point and the mouse).
I would not distinguish between the dragged point being selected and not selected, because it would be rather finicky to intuitively decide if the point to be moved is selected right in the moment of grabbing it.

1. If nothing is selected behaviour is the same as it is now (sigh!)
2. All selected points besides the point being moved stay in place
3. If all points are selected dragging by the arc moves the whole element with all its points keeping their relative positions.

Examples:
- select the two endpoints of the arc and move the center: center moves on the middle line between the fixed endpoints
- select one endpoint and move the center: the selected point stays where it is, the center can be moved freely, the third point moves as it does now when one endpoint is locked
- select one endpoint and move the other endpoint: the selected point stays where it is, the endpoint can be moved freely, the center point moves as it does now when one endpoint is locked
- select center and an endpoint and move the other endpoint: the point moves on a fixed radius around the fixed circle.
- select center and move endpoint: the point can be moved freely, the other point moves only in its distance to the center, the angle stays fixed. That is how it works now.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Deactivate constraints

Post by abdullah »

microelly2 wrote: Mon Jun 24, 2019 5:17 pm Nice idea to have a tool to deactivate non datum constraints. I see a use case that I can activate the constraints in a wished order.
Maybe this can be used to implement basinhopping strategies (https://docs.scipy.org/doc/scipy/refere ... pping.html)
I expected nothing less from you ;)

The problem there may be to control the movement when they are deactivated... or it may hop out of the basin... :lol:
Post Reply