View Issue Details

IDProjectCategoryView StatusLast Update
0003434SketcherBugpublic2018-05-31 11:55
ReporterAndreKR Assigned Toabdullah  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.17 
Target VersionFixed in Version0.18 
Summary0003434: Constraining to external geometry allows for an over-constrained sketch that goes undetected until the external geometry changes
DescriptionSteps to reproduce:

  • Create a Part cube
  • Create a sketch on one face of the cube
  • Use the External geometry button to import an edge of the cube
  • Create another line with a horizontal constraint
  • Create a coincident constraint with one end of the line and one end of the external line.
  • Do the same for the other two points.



It will now show "fully constrained sketch".

Now remove the horizontal constraint and add it back:



It will now show "Sketch contains redundant constraints".


If you take the "fully constrained sketch" from before and you close it and you change the cube that it references, then the sketch will be broken:

Additional InformationOS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13509 (Git)
Build type: Release
Branch: releases/FreeCAD-0-17
Hash: 0258808ccb6ba3bd5ea9312f79cd023f1a8671b7
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: German/Germany (de_DE)
TagsNo tags attached.
FreeCAD Information

Activities

AndreKR

2018-04-17 01:41

reporter   ~0011165

Related: https://forum.freecadweb.org/viewtopic.php?f=3&t=28127

abdullah

2018-04-22 05:32

manager   ~0011176

This is a very good example of how the solver works out partially redundant constraints. In fact, if we decide to change how it currently works, this example is a very good discussion point. Thanks for reporting it.

Does this behaviour look odd?

Yes, it does.

Is it a bug in the sense that the program operates contrary to its design decisions?

No, it is not. Improvements may come, but currently it is what it was thought it was right to do.

Why?

Observation 1: If you change the order of the constraints (after reproducing the example above, when it shows redundants, just delete the two coincident constraints, and add them again, causing the horizontal constraint to be the first constraint), the solver notifies a redundancy or it does not.

In order to understand what is happening, one has first to understand that the 3 constraints of this sketch (horizontal, coincidence 1, coincidence 2) operate on a line. When this is converted into an equation system at the solver, a line having two points and thus 4 DoF (4 parameters in the following) is being constraint by a horizontal (removes one DoF), a coincidence with a fixed position (removes 2 DoF), a second coincidence (removes 2 DoF), so in total 5 solver constraints (each removing one DoF).

For the solver all is an equation system, which has more equations than unknowns (though admittedly, one equation is linearly dependent of the others, otherwise it would not be redundant, but conflicting). It has to be noted that there is not a single one that is dependent on the others, one could say that 1 is dependent on 2-4, or that 3 is dependent on 1-2 and 4. The solver does not have a preference (yet), so it just selects as redundant one of them.

If we shortly come back to the beginning, 3 sketcher constraints represent 5 solver constraints. So if we rethink the numeric example above, we come to two possibilities, a) the horizontal (solver constraint nr. 1) is the redundant with the two coincident constraints, b) one of the coincidents (solver constraint nr.3) is the redundant with the horizontal and the other coincident, albeit only partly redundant (you could think that if you fully remove the coincident, you have 1 DoF and you can move the point, however if you put the coincident you have a redundancy).

The fathers of GCS acknowledged this partly redundancy problem, which arises in more complex cases, in which there is not a simple obvious solution (like in this case), just remove the horizontal. So they decided something in the line of:

1) The solver will tell me one solver constraint is redundant, I will check if the corresponding sketcher constraint introduced more than this solver constraint (like the coincident above), if so, the user can not delete it because he would be deleting in addition something he needs, so we can not ask him to do it, so we will ignore this redundancy for him.

2) However, if the sketcher constraint can be fully removed, then we complain to the user, because he can remove it and if we let him add more and more redundant constraints, and the end the sketch would be very difficult to understand.

The case is what the solver identifies as the redundant solver constraint. For this, ATM, the order is important.

I will give it a deeper thought, but I wanted to document what is happening first. My current opinion is that this is a "feature request" that needs some deeper thinking. :)

abdullah

2018-04-23 18:52

manager   ~0011184

A branch to test:
https://forum.freecadweb.org/viewtopic.php?f=8&t=6617#p229548

wmayer

2018-05-31 11:55

administrator   ~0011325

https://github.com/FreeCAD/FreeCAD/commit/03c3539dbfac10e38abc5f7fec8fefb8966d388e

Issue History

Date Modified Username Field Change
2018-04-17 00:59 AndreKR New Issue
2018-04-17 01:41 AndreKR Note Added: 0011165
2018-04-22 05:32 abdullah Note Added: 0011176
2018-04-23 12:37 abdullah Assigned To => abdullah
2018-04-23 12:37 abdullah Status new => assigned
2018-04-23 18:52 abdullah Note Added: 0011184
2018-05-31 11:55 wmayer Status assigned => closed
2018-05-31 11:55 wmayer Resolution open => fixed
2018-05-31 11:55 wmayer Fixed in Version => 0.18
2018-05-31 11:55 wmayer Note Added: 0011325