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

Lots of calculated positions create calculation errors

Post by Build-0-Matic »

I've been working on a complex design that will need to be resized easily, so I used a lot of calculated values for size and position with a lot of references.
But I've come to a point where one calculated value will show a different value whether I'm in the labels and attributes view or in the formula editing view.
Worse, when an object gets a value from another object, that value is wrong.
So I'm wondering if there is a limit to the number of calculated fields possible? Or maybe I've uncovered a bug? Or maybe it's just the clumsy me who's missed something. The file is over 3mb so I can't post it here :(

I'm currently running Freecad 0.20.2 on Windows 10.
User avatar
Shalmeneser
Veteran
Posts: 9475
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: Lots of calculated positions create calculation errors

Post by Shalmeneser »

Build-0-Matic wrote: Sun Mar 26, 2023 5:47 pm ... in the labels and attributes view ...
Are you speaking of TechDraw wb ? TechDraw_RedrawPage
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 »

No, I forgot to mention that it's all done in the Part workbench...
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: Lots of calculated positions create calculation errors

Post by heda »

you mean that you have rounding errors?

this is imho a weakness of fc, how this is handled.
right now, fc/occt behaves like a cad-system from the 80's, just stacking floating point errors on top of each-other.
it would be great if this was attacked within fc, i.e. that there is an "as intended by user" heuristics for floating point errors (meaning that 1.0 is and stays 1.0 and not 0.9999999998 or whatever it becomes when floating point discrepancies are passed along without touching them). one brutal fix could be to enforce rounding on used geometry, but that will lead to other issues, so to end up with something useful, one has to carefully select when one intervenes on floating point errors.

not so easy to say what the medicine is/should be without an example of your issue.

by the sound of it, you are using expressions, if so you can round in expressions at strategic places, which might improve things.

Code: Select all

round(6.44 * 10) / 10 # for one decimal rounding in expressions
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 »

I think I might have hit an upper limit of some kind.
I have a calculated value that, in the formula entry field, shows a value of 30mm. When I accept the calculation, it shows me a value of 7mm.
And when I ask another part to just copy that value, once accepted it shows a value of 36mm... definitely not just a rounding error.

So far I've worked around it by making another document and stripping calculation fields from it. But that's not a solution as I now don't have everything linked together. So modifications will become painful.
User avatar
Jolbas
Posts: 327
Joined: Sat Mar 26, 2022 7:48 am
Location: Sweden

Re: Lots of calculated positions create calculation errors

Post by Jolbas »

That is very big errors. Can you share the document for us to investigate or even better try to create a minimized example file. Then we should be able to find the problem and fix it.

Also you can download and test development version 0.21. Maybe it is due to an already fixed bug.
Syres
Veteran
Posts: 2893
Joined: Thu Aug 09, 2018 11:14 am

Re: Lots of calculated positions create calculation errors

Post by Syres »

Jolbas wrote: Sun Mar 26, 2023 7:31 pm Also you can download and test development version 0.21. Maybe it is due to an already fixed bug.
@Build-0-Matic I believe it was fixed by https://github.com/FreeCAD/FreeCAD/pull/8311 so this week's 0.21 build will be worth testing for sure.
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 »

OK, Thanks!
I'll try this for sure.
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 »

heda wrote: Sun Mar 26, 2023 6:50 pm ... right now, fc/occt behaves like a cad-system from the 80's, just stacking floating point errors on top of each-other. ...
Please excuse for intruding into this thread.

What heda is stating may possibly be related to another matter, where it would be of interest.

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?)?
If yes, can one or both settings of 'Number of decimals' and 'Tesselation' have an influence on it?

The questions are of a layman though - but also the laymans mind needs relief.. :)

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

Re: Lots of calculated positions create calculation errors

Post by chrisb »

Build-0-Matic wrote: Sun Mar 26, 2023 7:48 pm I'll try this for sure.
If it doesn't work, upload your file for further inspection.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply