Not fully-constrained, but FreeCAD thinks so

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!
Frotz
Posts: 105
Joined: Thu Jun 21, 2018 1:52 am

Not fully-constrained, but FreeCAD thinks so

Post by Frotz »

I don't think this one is related to https://forum.freecadweb.org/viewtopic.php?t=35743 or https://forum.freecadweb.org/viewtopic.php?f=3&t=35636.

I have a sketch of something that clearly has one degree of freedom, yet FreeCAD reports this as fully-constrained and the sketch passes Sketcher validation. I can even move up and down the horizontal line just below the dark blue vertical line (construction geometry). What's going on here?
bad-fully-constrained.png
bad-fully-constrained.png (32.02 KiB) Viewed 1300 times

Code: Select all

OS: Debian GNU/Linux 11 (bullseye) (MATE/mate)
Word size of FreeCAD: 64-bit
Version: 0.21.0.31702 (Git)
Build type: Unknown
Branch: master
Hash: 633a6e825ca37cc7111fbfa8d7a53ec23e1c29bd
Python 3.9.2, Qt 5.15.2, Coin 4.0.0, Vtk 7.1.1, OCC 7.5.1
Locale: English/United States (en_US)
Installed mods: 
  * Assembly3 0.11.4
  * Pyramids-and-Polyhedrons
  * sheetmetal 0.2.60
  * freecad.gears 1.0.0
  * A2plus 0.4.60g
  * fasteners 0.4.50
  * Manipulator 1.4.9
Attachments
bad-fully-constrained.FCStd
(14.58 KiB) Downloaded 26 times
User avatar
Shalmeneser
Veteran
Posts: 9475
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: Not fully-constrained, but FreeCAD thinks so

Post by Shalmeneser »

CAN YOU HIDE THE GRID NEXT TIME :evil:
(don't understand how you can stand this horror)

The blue 'blue' line cannot be perpendicular because 23=22=20 and vertical constraints on this vertical.
@abdullah : It's a bug/problem in sketcher solver.

You should not create a new point for your symmetry but use symmetry with axis instead.

You need 53 constraints, but me 38, and @chrisb will need ...
Attachments
fully-constrained_SHALM.FCStd
(15.85 KiB) Downloaded 16 times
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

Re: Not fully-constrained, but FreeCAD thinks so

Post by chrisb »

Shalmeneser wrote: Sun Jan 29, 2023 12:04 am You need 53 constraints, but me 38, and @chrisb will need ...
Thanks for the compliment :D , but I will not redo this. (And I'm glad that my graphics card doesn't show the grid properly).
It should be noted, that this sketch uses indeed very few dimensions, that's well done!

We had in the past already an issue with equality constraints, and it was discussed here in the forum. And yes, if I remove Constraint23 the effect vanishes immediately. I can then even re-add the equality constraint between these selected lines:
SnipScreenshot-ef059a.png
SnipScreenshot-ef059a.png (58.25 KiB) Viewed 1193 times
@abdullah, some questions:
- do you need a github ticket?
- do you need the file in the state before it happens?
- should I simplify it as far as possible?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: Not fully-constrained, but FreeCAD thinks so

Post by jnxd »

chrisb wrote: Sun Jan 29, 2023 1:49 am @abdullah, some questions:
- do you need a github ticket?
- do you need the file in the state before it happens?
- should I simplify it as far as possible?
In general it's best to make a new ticket. With the new contributing guidelines that's the targetted way to go.

Simplifying will help if you can replicate the issue with a samaller case.
My latest (or last) project: B-spline Construction Project.
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

Re: Not fully-constrained, but FreeCAD thinks so

Post by chrisb »

@Frotz, can you please create a ticket. You can attach this file to it, it is slightly simplified.
It's still the same two lines which show the error when equality is applied.
SnipScreenshot-2dfc91.png
SnipScreenshot-2dfc91.png (63.51 KiB) Viewed 1014 times
The effect vanishes if (e.g.) this selected line is removed:
SnipScreenshot-00973b.png
SnipScreenshot-00973b.png (63.47 KiB) Viewed 1014 times
Attachments
bad-fully-constrained_cb.FCStd
(4.37 KiB) Downloaded 12 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Not fully-constrained, but FreeCAD thinks so

Post by openBrain »

Something important to notice in this example is that there is a redundant constraint somewhere (most probably it's a partially redundant with a symmetric or coincident constraint -- most probably the sooner).
Indeed the sketch has 76 DOFs and the constraints consume ... 76 DoF.
That would be good to know if originally it was undetected by the solver, or detected but ignored by the user. :)
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Not fully-constrained, but FreeCAD thinks so

Post by openBrain »

OK, finally as said by @chrisb problem seems to be brought by equality.
The redundancy is present in the wire loop formed by the left vertical bar of the 'H' shape.
Starting from the extreme left :
* The most left vertical line is constrained 'vertical'
* Then the top and bottom lines linked to it are constrained 'horizontal' and 'equal'
* Then all the lines closing the loop (3 normal + 2 construction) are all constrained 'vertical', which is redundant

I guess it's not so obvious to detect as the equality constraint could be "flipped" (each horizontal line going in opposite direction), and so if not all vertical lines were constrained 'vertical', there will be another valid solution.
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

Re: Not fully-constrained, but FreeCAD thinks so

Post by chrisb »

I don't think that the flipping affects the solver, at least not in general. If I remove the right upper horizontal line as indicated above, and I then add the equality, the solver correctly reports the redundancy. The flipping situation is the same as before.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Frotz
Posts: 105
Joined: Thu Jun 21, 2018 1:52 am

Re: Not fully-constrained, but FreeCAD thinks so

Post by Frotz »

domad
Veteran
Posts: 2054
Joined: Mon Jun 22, 2020 12:16 pm

Re: Not fully-constrained, but FreeCAD thinks so

Post by domad »

Greetings to the Community!
The gif shows the erroneous behavior of complete geometry constraint, not if this animation can be useful (@abdullah ) for the purpose of locating the problem.
Attachments
error_bug_validation_constraints.gif
error_bug_validation_constraints.gif (265.92 KiB) Viewed 571 times
Post Reply