sketcher: wrong redundancy solving with symmetry

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

sketcher: wrong redundancy solving with symmetry

Post by uwestoehr »

In recent discussions about the sketcher symmetry handling I mentioned an issue I think it is incorrect. Here it is:

- open the attached sketch:
Sketch-symmetry-issue.FCStd
(9.82 KiB) Downloaded 107 times

The solver tells you there are redundant constraints.

- now delete the symmetry constraint

The redundancy message is now gone but you get 1 degree of freedom. To eliminate it it is sensible to set the symmetry constraint you just deleted.
It is in my opinion a bug that one cannot set here the symmetry. (I am aware that there are workarounds but for the later development I need a symmetry constraint here, not a dimensional one.)

Can anybody reproduce this?

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17331 (Git)
Build type: Release
Branch: master
Hash: cf18161dc26267c259ac21675cb9637263bf4152
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: sketcher: wrong redundancy solving with symmetry

Post by openBrain »

Sorry but (IMO) you're wrong and the solver is correct. ;)
The top arc of your example is redundantly constrained because it's center is coincident to the origin.
This geometrically imposes that :
  • If its both endpoints are on the same horizontal, the horizontal distance from each endpoint to Y axis is equal
  • Oppositely, if its both endpoints are at the same distance from Y axis, they are on the same horizontal (modulo 90° to be strictly precise)
The problem is that a symmetry against Y axis imposes both conditions (same horizontal + same distance to Y axis) => I guess you perfectly understand it's redundant.

I see 2 simple ways of being geometrically correct :
  • Either only apply an horizontal constraint between the 2 arc endpoints => IMO this is the best way
  • Or keep the symmetry, remove the coincidence between arc center & origin, then only constraint the arc center to be on the X axis with a point-on-line
Hope it helps. ;)
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: sketcher: wrong redundancy solving with symmetry

Post by openBrain »

What baffles me is that solver doesn't complain with the following simple example (arc center is coincident with origin) :
simple_arc.png
simple_arc.png (2.74 KiB) Viewed 1264 times
At least with my version :
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16110 (Git)
Build type: Release
Branch: (HEAD detached at upstream/releases/FreeCAD-0-18)
Hash: f7dccfaa909e5b9da26bf50c4a22ccca9bb10c40
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: French/France (fr_FR)
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: sketcher: wrong redundancy solving with symmetry

Post by openBrain »

More precisely :
  • Sketch an arc with its center coincident to origin => Solver says 3 DoF (OK)
  • Add a symmetry between its 2 endpoints against the Y axis => Solver says 1 DoF (NOK)
  • Drag the arc with mouse => Solver says 2 DoF (OK !!) but doesn't complain (NOK)
Can someone confirm (preferably with 0.19 version) ?
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: sketcher: wrong redundancy solving with symmetry

Post by bejant »

openBrain wrote: Tue Jul 16, 2019 1:12 pm Add a symmetry between its 2 endpoints against the Y axis => Solver says 1 DoF
Here my Solver says 2 DOF remaining.

20190716a.png
20190716a.png (36.55 KiB) Viewed 1251 times


OS: Ubuntu 18.04.2 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19. <== date is 2019/07/08
Build type: Release
Python version: 3.6.8
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: sketcher: wrong redundancy solving with symmetry

Post by uwestoehr »

openBrain wrote: Tue Jul 16, 2019 1:02 pm I guess you perfectly understand it's redundant.
Thanks for having a look. But I cannot follow your argumentation because when I delete the symmetry constraint I get 1 DOF. Then I can change the horizontal and y-position. An example:
Sketch-symmetry-issue2.FCStd
(12.02 KiB) Downloaded 52 times
But as you write: "symmetry against Y axis imposes both conditions (same horizontal + same distance to Y axis)" and this is exactly what I need.

openBrain wrote: Tue Jul 16, 2019 1:02 pm I see 2 simple ways of being geometrically correct :
  • Either only apply an horizontal constraint between the 2 arc endpoints => IMO this is the best way
  • Or keep the symmetry, remove the coincidence between arc center & origin, then only constraint the arc center to be on the X axis with a point-on-line
The second one is intuitive and requires additional work -> breaking workflow. The first one is not an option because I need the sypmmetry (sketch will later CCed, arc cut etc.)

openBrain wrote: Tue Jul 16, 2019 1:08 pm What baffles me is that solver doesn't complain with the following simple example (arc center is coincident with origin) :
Same here and that fits perfectly to my understanding of the the symmetry constraint ;) .
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: sketcher: wrong redundancy solving with symmetry

Post by uwestoehr »

openBrain wrote: Tue Jul 16, 2019 1:12 pm Can someone confirm (preferably with 0.19 version) ?
With 0.18 not 0.19 I get correctly only 2 DOF.

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17331 (Git)
Build type: Release
Branch: master
Hash: cf18161dc26267c259ac21675cb9637263bf4152
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)

and

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16117 (Git)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: dbb4cc6415bac848a294f03b80f65e888d531742
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: sketcher: wrong redundancy solving with symmetry

Post by bejant »

uwestoehr wrote: Tue Jul 16, 2019 11:59 am The solver tells you there are redundant constraints.

- now delete the symmetry constraint

The redundancy message is now gone but you get 1 degree of freedom. To eliminate it it is sensible to set the symmetry constraint you just deleted.
My Solver messages report that the Sketch is Over Constrained (not that there are Redundant Constraints).

Other Constraints should be favored over the Symmetry Constraint so to me it would be more sensible to:
1. Apply the Equality Constraint to the two vertical edges, or less desirably,
2. Apply the Symmetry to upper right and lower left vertices, or to upper left and lower right vertices, and the Y-Axis.

Interestingly, if I apply the Symmetry Constraint before the 4mm Horizontal Distance Constraint, there is no problem (one of the Conflicting Constraints probably got deleted).

(I had to make sure I was dealing with the original file)
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: sketcher: wrong redundancy solving with symmetry

Post by openBrain »

bejant wrote: Tue Jul 16, 2019 1:57 pm
openBrain wrote: Tue Jul 16, 2019 1:12 pm Add a symmetry between its 2 endpoints against the Y axis => Solver says 1 DoF
Here my Solver says 2 DOF remaining.
Thanks for testing with 0.19. I expect some things have move on between 0.18 & 0.19. But still the solver doesn't complain, which is weird. ;)
bejant wrote: Tue Jul 16, 2019 2:29 pm My Solver messages report that the Sketch is Over Constrained (not that there are Redundant Constraints).
Yep. It depends on whether you use 0.18 or 0.19. I think both are acceptable. ;)
uwestoehr wrote: Tue Jul 16, 2019 2:13 pm Thanks for having a look. But I cannot follow your argumentation because when I delete the symmetry constraint I get 1 DOF. Then I can change the horizontal and y-position.
No. There is only one DoF because x & y positions are linked by an equation. You can see the (only) remaining DoF as being the arc apex angle, or the arc chord length.
But as you write: "symmetry against Y axis imposes both conditions (same horizontal + same distance to Y axis)" and this is exactly what I need.
The question here isn't what you need. The solver don't care of that. :)
The question is that constraint set is mathematically (precisely geometrically) correct. ;)
And in this case (an arc with center coincident with origin and with endpoints symmetric against Y axis) there is clearly some redundancy. ;)
The second one is intuitive and requires additional work -> breaking workflow. The first one is not an option because I need the sypmmetry (sketch will later CCed, arc cut etc.)
Unintuitive :?:
With both of them you have the symmetry. Not displayed for sure, but geometrically imposed by constraint set. ;)
Unfortunately their is no "intuitive" constraint set where you can get the symmetry constraint used as is.
Same here and that fits perfectly to my understanding of the the symmetry constraint ;) .
Here again this isn't about how you figure out a symmetry but about what mathematical relation it implies.
If you want to get some idea, sketch an arc and just constraint its 2 endpoints with a symmetry against Y axis(nothing else).
Then try to wiggle everything (the arc, its endpoints, its center) => You absolutely can't have a valid solution where the center is out of the Y axis. Thus any other constraint that will also constraint the center on the Y axis (typically coincidence to origin is one of them) is redundant. ;)
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: sketcher: wrong redundancy solving with symmetry

Post by uwestoehr »

bejant wrote: Tue Jul 16, 2019 2:29 pm My Solver messages report that the Sketch is Over Constrained (not that there are Redundant Constraints).
Yes, sorry for being incorrect.

bejant wrote: Tue Jul 16, 2019 2:29 pm 1. Apply the Equality Constraint to the two vertical edges, or less desirably,
2. Apply the Symmetry to upper right and lower left vertices, or to upper left and lower right vertices, and the Y-Axis.
1. is no option because I need the symmetry for later actions (sketch will be CCed and the arc will go in the new sketch...)
2. leads here to an over constrained error.
Last edited by uwestoehr on Tue Jul 16, 2019 5:45 pm, edited 1 time in total.
Post Reply