Lots of calculated positions create calculation errors

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
Build-0-Matic
Posts: 54
Joined: Fri Dec 20, 2019 9:31 pm

Re: Lots of calculated positions create calculation errors

Post by Build-0-Matic »

The problem is that the file is too large for the site (I hit the upload limit)
But I did find what appears to be a workaround by limiting the number of cross-references between separate parts. I'll check it again.

Now, this was just plain weird... I've been working on the file once again and it seems that deleting a bunch of cross-references and re-writing them fixed it...

I'm starting to think that there was some corruption in the file and FreeCAD was attempting to compensate by creating more errors.
But now, it looks like things are fixed.

Oh, well... :roll:

Thanks
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Lots of calculated positions create calculation errors

Post by onekk »

Ulicad wrote: Sun Mar 26, 2023 9:07 pm ...
My question is:
Are floating point errors - in relation to the accuracy of elements and their dependencies - 'able' to cause breakage of parts or malfunctioning in a model (in rare cases perhaps?)?
...
Floating point errors are the normality in a binary system but probably you have to be aware of the fact that most of the approximation is around 1e-7 some OCCT have 1e-4 that is expressed in mm.

The point is that usually this is not a problem as IEEE floting point is well know and eith a 64bit float is negligible, you have the imprecision in the last binary digit when a number could not be expressed exactly as a power of 2. Search IEEE precision.

There are workaround, but probably what is used in most CADs is simply applying a rounding to the number shown .

Probably real error is aroun the 15 digit after the decimal point.

This not hide the fact that multiplicating could worsen things, what has to be seen is where things are worsen.

Internally of FreeCAD calculation routines of only when using Expressions?

Probably the error reported from OP is due to some unitless number in a unit expression, but this has been documented around many times.

Probably some caveats in the wiki page about expression (if there are not yet any) will suffice, provided that users read wiki pages and this is not always true.

If there is a real bug, it will be interesting to see why it is happening as nothing is perfect and code could be corrected to achieve expected results.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Syres
Veteran
Posts: 2893
Joined: Thu Aug 09, 2018 11:14 am

Re: Lots of calculated positions create calculation errors

Post by Syres »

@onekk the fix was backported to the 0.20 branch last night git commit de2e122
Ulicad
Posts: 311
Joined: Tue Aug 16, 2022 10:35 am
Location: de_DE

Re: Lots of calculated positions create calculation errors

Post by Ulicad »

onekk wrote: Mon Mar 27, 2023 6:25 am ... what has to be seen is where things are worsen. ...
This is my actual concern.

The limited accuracy as such clearly is unavoidable under earthly conditions, if - for instance - floating point numbers real numbers are involved (independent of the way this is handled by FC).

Would you have an example or the experience of some entity breaking in an FC-model due to this fact?

To have knowledge of this could round up some other things.

Thanks in advance!
Last edited by Ulicad on Mon Mar 27, 2023 1:46 pm, edited 1 time in total.
Regards, Ulicad / Uli
---
en: New FC-user, virgin to previous CAD-work, labouring on his new hobby Ulis Blog
de: Neuer FC-Nutzer, ohne vorhergehende CAD-Erfahrung, beschäftigt mit seinem neuen Hobby Ulis Blog
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Lots of calculated positions create calculation errors

Post by onekk »

Ulicad wrote: Mon Mar 27, 2023 8:46 am ...

Would you have an example or the experience of some entity breaking in an FC-model due to this fact?

To have knowledge of this could round up some other things.
...
Not exactly, as I don't use too much expressions.

I'm used to script my models, so usually the accuracy is good, as it rely on the Python math, that it is not too bad.

But, I work in mm so I don't use any units in my code, only when dealing with some fields like in PD or Sketcher where a Unit is needed, I have to cope with units, but not too much as FreeCAD internally will return things in mm, and OCCT too.

Python has this page:

https://docs.python.org/3/tutorial/floatingpoint.html

that link to this interesting page:

https://www.lahey.com/float.htm

I think that even the C++ compiler has similar problems, as it is using same binary representation.

There are around some "high precision" library, but the point is how much precision is needed in "real life", As probably a CAD is not meant to be used at molecular level, probably if you not work with precision optics or Chip designing you have to cope with "machining precision" that is far more less than the computational precision of Python and C++.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Lots of calculated positions create calculation errors

Post by onekk »

Syres wrote: Mon Mar 27, 2023 8:38 am @onekk the fix was backported to the 0.20 branch last night git commit de2e122
Thnaks, but my answer was more a general answer, as I can't see what the problem is in this case, I know that there are some problems with expressions and units, but as I use only mm, I don't use units at all, so usually I have no problems.

I know however even if you use metric and want as example to use meters you are facing same problem.

Happy to know that something is improving even in such aspect. I have no doubt on the competent work of developers.

FreeCAD is good in my opinion, perfection is only a philosophical concept, all the mathematics is dominated by the concept of error and approximation, see the most know example:

https://en.wikipedia.org/wiki/Limit_of_ ... n_of_limit

not counting integrals an similar trivial things.

But today there are GH problems so I have not managed to see the commit.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
Build-0-Matic
Posts: 54
Joined: Fri Dec 20, 2019 9:31 pm

Re: Lots of calculated positions create calculation errors

Post by Build-0-Matic »

One thing I did notice is that in a previous working session there were odd things happening. At first I didn't think much of them but in retrospect these were probably important.
I had a part turned at 270° (which I hadn't touched), so I just reset it to the correct orientation.
But then I started having some visual glitches, like selecting a part would make the entire model a bit like an X-Ray (it looked pretty cool though).
I kept getting weird dependency errors that were really hard to trace as they linked to objects that seemed non-existent.
Eventually I was fed-up with the bugs and closed the program just to move-on to something else.

I really regret not having kept a copy of the buggy file...

It would be super cool if there was a workbench that could help in tracing dependency errors and fixing them. The thing is that when I see a Cut039 error, it's not always obvious to find out what label Cut039 has in real life. And even then, it's not easy to see what the error really is.
Syres
Veteran
Posts: 2893
Joined: Thu Aug 09, 2018 11:14 am

Re: Lots of calculated positions create calculation errors

Post by Syres »

Build-0-Matic wrote: Mon Mar 27, 2023 3:14 pm it's not always obvious to find out what label Cut039 has in real life.
That's easy, it already exists but you just need a pointer, see https://wiki.freecad.org/Selection_view and with the new panel added navigate down to Search bar if you Edit menu > SelectAll and then start typing Cut039 into the Search bar at the top of the Selection View panel it'll tell you the label in brackets.

With regard to errors, the only way is to copy them first into your favourite internet Search browser with site:freecad.org appended to the error and if unsuccessful raise a new topic here.
User avatar
Build-0-Matic
Posts: 54
Joined: Fri Dec 20, 2019 9:31 pm

Re: Lots of calculated positions create calculation errors

Post by Build-0-Matic »

Syres wrote: Mon Mar 27, 2023 4:09 pm That's easy, it already exists but you just need a pointer, see https://wiki.freecad.org/Selection_view and with the new panel added navigate down to Search bar if you Edit menu > SelectAll and then start typing Cut039 into the Search bar at the top of the Selection View panel it'll tell you the label in brackets.
That's the big problem with the error I had: the object in the error was nowhere to be found!
Post Reply