Sketcher Symmetric constraint hides redundant 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!
ulrich1a
Posts: 1905
Joined: Sun Jul 07, 2013 12:08 pm

Sketcher Symmetric constraint hides redundant constraints

Postby ulrich1a » Wed May 14, 2014 9:14 pm

I got the following inconsistent behavior: Making first two connected lines and adding a symmetry constraint to the three vertices produces a straight line. Adding a parallel constraint to those lines gives a sketcher warning about redundant constraints. Doing the same in reversed order, gives no warning.

Adding symmetries to polylines with three or more parallel lines freezes the line. There is no warning, that this construct has redundant constraints.

Is this a bug?

Ulrich

edit: changed topic
ulrich1a
Posts: 1905
Joined: Sun Jul 07, 2013 12:08 pm

Re: Sketcher Symmetric constraint hides redundant constraint

Postby ulrich1a » Sat May 17, 2014 5:29 pm

The symmetric constraint seems to overlook nearly all redundant constraints. At applying a symmetric constraint to certain cases it is possible to produce a sketch with a lot of redundant constraints. First there is no problem. Sometimes a line freezes and is not movable even with reported several degrees of freedom. In other cases those hidden redundant constraints are suddenly detected at changing things at non related objects.
Here is an example of a frozen sketch:
frozen_sketch.png
Frozen sketch with symmetric constraint
frozen_sketch.png (70.95 KiB) Viewed 2974 times
Sometimes I could move the object, but it jumps. The reported degree of freedom changes between 4 and 5.
An symmetric constraint was applied between the endpoints of the arc and the horizontal line. After adding the vertical line, the sketch became unmovable.
Hidden redundant constraints are easy constructed with applying a symmetric constraint to:
Two lines with parallel constraint.
Two lines with equality constraint.
Two lines with perpendicular constraint.
Endpoint of arcs with symmetry to a line through the center of the arc.
There may be also other cases.

Ulrich

OS: Debian GNU/Linux 7.5 (wheezy)
Platform: 32-bit
Version: 0.14.3609 (Git)
Branch: master
Hash: 052b628cbf02624f53e5b844e0c92083b83d368e
Python version: 2.7.3
Qt version: 4.8.2
Coin version: 3.1.3
SoQt version: 1.5.0
OCC version: 6.7.0
Attachments
Frozen_sketch.fcstd
(2.94 KiB) Downloaded 64 times
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Sketcher Symmetric constraint hides redundant constraints

Postby abdullah » Mon Apr 23, 2018 12:42 pm

Hi!

I have some code that solves this issue, and also those of:
https://forum.freecadweb.org/viewtopic. ... 424#p51775
https://freecadweb.org/tracker/view.php?id=3434

probably more from the tracker GCS project.

I need a/some volunteer(s) for help testing this code modification.

The branch is this:
https://github.com/abdullahtahiriyo/Fre ... mprovement

What is this?
Well, you get the DoF finder (https://github.com/FreeCAD/FreeCAD/pull/1345), and on top of that a new commit intended to improve the detection of redundants.

How does it work internally?
The solver uses some heuristics to determine the "redundant to remove" and notify it to the user.

Basically it would pick the solver redundant constraint that affects most groups of redundants (popularity contest).

In the simple cases, all the redundants are equally popular and the popularity contest is untied by using the tagid (let say for simplicity it is the number at sketcher level Constraint3, the tagid=3).

This means that in simple cases, the solver systematically decides that the redundant constraint to handle from those showing a linear dependency is the one appearing the last.

This commits changes the way to untie the popularity contest, by giving more priority to those sketcher constraints that need a lower number of solver constraints (in other words,
those constraints that remove a lower amount of DoF). In case of tie, the tagid is then used to break the tie.

See my comment on this, for more details:
https://freecadweb.org/tracker/view.php?id=3434
The diff:
https://github.com/abdullahtahiriyo/Fre ... f846540d8a

What do you need?

Clone that branch. Compile it. Go through the tickets in the tracker in the GCS project relating to problems with redundants or with reporting of redundants or the symmetric constraint, or wrongly indicating is fully constraint. Try to reproduce them. If you can not report it here as solved.

You can also try to force redundants/conflicting with that code and/or use it in a "not very relevant" project and feedback.

I do not anticipate any side effect, but well, you know, a need control groups and administer a dosage of this branch to only some individuals and a placebo to others.... :lol:

What is in for me?

You are making FreeCAD better. What else? :lol:

Making the solver messages way more reliable. Better detection of redundancies.

:) :) :) :) :)
chrisb
Posts: 19703
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher Symmetric constraint hides redundant constraints

Postby chrisb » Mon Apr 23, 2018 11:13 pm

If a MacOS user is willing to create a compiled version I am of course willing to test.
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Sketcher Symmetric constraint hides redundant constraints

Postby abdullah » Wed Apr 25, 2018 12:16 pm

triplus wrote:...interesting...
sgrogan wrote:...testing...
I do not know guys if you would be interesting in this.

ATM, I do not know if anybody else have testing time. I think it would be great if we could give this branch a good run. It could be the "solver improvement" we have been longing for for a long time...
User avatar
sgrogan
Posts: 5475
Joined: Wed Oct 22, 2014 5:02 pm

Re: Sketcher Symmetric constraint hides redundant constraints

Postby sgrogan » Wed Apr 25, 2018 12:52 pm

abdullah wrote:
Wed Apr 25, 2018 12:16 pm
I do not know guys if you would be interesting in this.
I will make a win build for testing
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Sketcher Symmetric constraint hides redundant constraints

Postby abdullah » Wed Apr 25, 2018 3:10 pm

sgrogan wrote:
Wed Apr 25, 2018 12:52 pm
abdullah wrote:
Wed Apr 25, 2018 12:16 pm
I do not know guys if you would be interesting in this.
I will make a win build for testing
Thanks! :)