Sketcher solver redundancy error

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
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Sketcher solver redundancy error

Post by NormandC »

bejant wrote: Sat Apr 20, 2019 4:46 pm OS: Ubuntu 18.04.2 LTS
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.18.16093 (Git)
Sorry for the off topic, but I'm curious: is there a reason for using the freecad-daily package (which is stuck ATM) rather than the newer freecad-stable one? It is based on the 0.18.1 tag, which corresponds to 0.18.16110. It's been available for the past two weeks.
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Sketcher solver redundancy error

Post by bejant »

I tried to update and it broke my FreeCAD stable. I haven't had much time to look into it further. If I can't fix it I'll post in one of the appropriate topics.
User avatar
Hannu
Posts: 130
Joined: Fri Sep 11, 2015 4:12 pm
Location: Strängnäs, Sweden - 1hr drive west from Stockholm

Re: Sketcher solver redundancy error

Post by Hannu »

bejant wrote: Sat Apr 20, 2019 4:46 pm ... adding a Tangency Constraint there using Box Selection to select the Coincident Endpoints creates the Solver error for me.
I have seen the "repeating redundancy error" a number of times, and most often use box selection to select points to set constraints on. Never figured out the selection method to be related though - and therefore haven't made any postings regarding it.

One needs to have some understanding of the problem before a posting can be made.
/Hannu - engineer & mild :geek:
- Embedded, Computer, Software, Electronic, Fault analysis. A&D Photography http://flickr.com/arkane
- Mechanics, FDM 3D-prints, Solder, Lathe, Mill, Weld -work. ISO Audits, Claim, Deviation, Corrective action
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher solver redundancy error

Post by abdullah »

Hi folks,

I am interested in knowing why the coincident constraint is directed to an "edge" instead of a point:
Screenshot_20190422_121715.png
Screenshot_20190422_121715.png (41.67 KiB) Viewed 956 times
Constraint 1 is [(1,2),(-1,0)]

The software should never generate that 0 there. If you happen to notice this behaviour, I would be thankful to know how these get created.
minimal_reproduction.FCStd
(9.79 KiB) Downloaded 22 times
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher solver redundancy error

Post by abdullah »

The problem is that coincident constraint to an edge, which the solver does not accept. This creates the sketcher and solver constraints to get out of sync.

This is a fixed file:
Xiaomi Redmi 4X_brokenSkeetch_fixed.FCStd
(942.86 KiB) Downloaded 24 times
In this file the sketch still appears as "redundant", but if you click you get to the two redundant constraints.

I fixed it like this:

Code: Select all

>>> constraints = ActiveSketch.Constraints
>>> con18 = ActiveSketch.Constraints[17]
>>> con18.Type
'Coincident'
>>> con18.SecondPos
0
>>> con18.SecondPos = 1
>>> constraints[17] = con18
>>> ActiveSketch.Constraints = constraints
>>> ActiveSketch.solve()
-2
You canNOT use this code above in stock FreeCAD, because SecondPos is readonly. I will be submitting a PR to make it r/w.

I am refactoring the parts of the solver making the QR calculation, so any fix will go with it.

THIS DOES NOT FIX THE CAUSE OF THE PROBLEM

There is a way to create coincident constraints to edges (PointPos=0) in FreeCAD, which is the real source of grievance and the bug to be fixed.
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Sketcher solver redundancy error

Post by bejant »

kisolre wrote: Sun Apr 21, 2019 6:20 am I think that the quesion should be the other way around - why are there errors at your end. Those are relatively simple sketches.
I don't know why. When I try to recreate the Additive Sweep using Sketches "RightBottomCurve" and "ExternalProfile", I get an error window with the message: "TopoDS::Face".

This is with me using a newer FreeCAD version since yesterday (info below).

abdullah wrote: Mon Apr 22, 2019 10:20 am I am interested in knowing why the coincident constraint is directed to an "edge" instead of a point:
FreeCAD also doesn't move the line segment onto the origin...

And for anyone who wants to know more about Constraint geoID and posID numbering:
https://forum.freecadweb.org/viewtopic.php?f=10&t=28890


OS: Ubuntu 18.04.2 LTS
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.18.1.
Build type: Release
Python version: 3.6.7
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher solver redundancy error

Post by abdullah »

With the PR, I will be providing with some hint:

Code: Select all

Active view is Xiaomi Redmi 4X_brokenSkeetch : 1[*] (at 0x5582d6f62670)
Sel : Clear selection
Sketcher constraint number 17 is malformed!
SolverReportingManager - Too long string suppressedEigenSparseQR, Threads: 1, Vectorization: On, Pivot Threshold: 1e-13, Params: 130, Constr: 126, Rank: 124
Sketcher constraint number 18 is malformed is in red in the report view. This should enable users to identify malformed constraints. If you happen to realise this message just after doing some operation and can provide a way to reproduce, I am waiting for your bug reports ;)
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher solver redundancy error

Post by abdullah »

bejant wrote: Mon Apr 22, 2019 12:46 pm FreeCAD also doesn't move the line segment onto the origin...
The constraint is malformed, so the solver is effectively ignoring it.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher solver redundancy error

Post by abdullah »

PR:
https://github.com/FreeCAD/FreeCAD/pull/2093

With this PR I hope that you guys can help me out here identify when FreeCAD is creating these malformed coincident constraints.
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: Sketcher solver redundancy error

Post by kisolre »

I found another coincidence to (-1,0) in one of my sketches so I am going to examine and remove them by hand. Is it possible to automate that? A script to iterate througn all sketches, check if there are coincidences to edge and report those?

Edit: It turned out to be in the begining so all subsequent sketches which were copies if it carried that constraint. Which was easy fix. But a macro will still be nice :)
Last edited by kisolre on Mon Apr 22, 2019 5:37 pm, edited 1 time in total.
Post Reply