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!
Post Reply
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Sketcher Symmetric constraint hides redundant constraints

Post by ulrich1a »

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
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Sketcher Symmetric constraint hides redundant constraint

Post by ulrich1a »

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 with symmetric constraint
Frozen sketch with symmetric constraint
frozen_sketch.png (70.95 KiB) Viewed 4309 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 106 times
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher Symmetric constraint hides redundant constraints

Post by abdullah »

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
Veteran
Posts: 54140
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher Symmetric constraint hides redundant constraints

Post by chrisb »

If a MacOS user is willing to create a compiled version I am of course willing to test.
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 Symmetric constraint hides redundant constraints

Post by abdullah »

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
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Sketcher Symmetric constraint hides redundant constraints

Post by sgrogan »

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
"fight the good fight"
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher Symmetric constraint hides redundant constraints

Post by abdullah »

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! :)
Post Reply