Ticket #4024 - FreeCAD should not recompute the whole model on every single change of a spreadsheet

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
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Ticket #4024 - FreeCAD should not recompute the whole model on every single change of a spreadsheet

Post by uwestoehr »

I try to uses spreadsheets for constructions works more frequently but there are some issues making it hard to work with spreadsheets.
Spreadsheets destroy all the time my parts. Take for example this file:
http://ftp.lyx.de/Billas/v2.5.1-3D-Druc ... anal.FCStd
(too large to upload it to the forum)

- open the spreadsheet
- add something to an empty cell (for example write "hello" to cell C3) and leave the cell afterwards

result: at first FreeCAD freezes for about a minute then the part is broken.

That is weird because there is no need to recalculate anything since I just wrote a comment to the spreadsheet to a cell that is nowhere referenced in the construction.

Can anyone confirm this?

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16117 (Git)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: dbb4cc6415bac848a294f03b80f65e888d531742
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
Last edited by uwestoehr on Fri Sep 13, 2019 2:29 pm, edited 2 times in total.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: FreeCAD freezes and destroys parts when changing anything in a spreadsheet

Post by TheMarkster »

If I do a recompute of your model it shows errors on some of the features, complaining about multiple solids not being supported. This happens without touching the spreadsheet, which is probably not the issue here. Modifying the spreadsheet triggers the recompute, which then shows the errors. This could be due to the topological naming issue, but I'm not absolutely certain of this. Some of the sketches appear to be no longer attached where intended. This can happen when you attach to a face, then that face's number id changes. A good general recommendation is to attach sketches to one of the planes, in your case, the xy_plane. Attach to the plane, then move the sketch up or down relative to that plane in order to position it. For example, if you padded the previous layer 0.15mm, then when you create the next sketch attach it to the xy_plane, but then move it up 0.15mm in the z direction rather than attaching it to the previous face. Then if that layer is also .15mm, the next sketch would be moved .30mm. It's very simple and convenient to simply attach to a face, but can lead to problems like what you are experiencing here sometimes.
kisolre
Veteran
Posts: 4162
Joined: Wed Nov 21, 2018 1:13 pm

Re: FreeCAD freezes and destroys parts when changing anything in a spreadsheet

Post by kisolre »

Try not to use "-" in your names. Use "_" instead. When using expressions "-" is treated as minus sign and autocomplete does not work to find the proper name.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: FreeCAD freezes and destroys parts when changing anything in a spreadsheet

Post by uwestoehr »

TheMarkster wrote: Sat Jun 15, 2019 2:20 am Modifying the spreadsheet triggers the recompute
But this is the problem for me when working with spreadsheets. I chose an unfinished construction example to demonstrate that unnecessary recalculations are not only time consuming but also a problem in the work flow.
My point is that when I just enter something in a new spreadsheet cell there is no need for a recalculation and therefore no calculation should be performed.
kisolre wrote: Sat Jun 15, 2019 8:09 am Try not to use "-" in your names. Use "_" instead.
Thanks for this hint. I will replace the "-" signs in names and avoid them in future.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: FreeCAD freezes and destroys parts when changing anything in a spreadsheet

Post by TheMarkster »

uwestoehr wrote: Sat Jun 15, 2019 11:17 pm
But this is the problem for me when working with spreadsheets. I chose an unfinished construction example to demonstrate that unnecessary recalculations are not only time consuming but also a problem in the work flow.
My point is that when I just enter something in a new spreadsheet cell there is no need for a recalculation and therefore no calculation should be performed.
There is a way to mitigate this somewhat if you have a number of cells to change and don't want to wait for the recompute after each change. Right-click on the document name in the tree and select "Skip recomputes". After you've made your changes to your cells you can then re-enable recomputes the same way.
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: FreeCAD freezes and destroys parts when changing anything in a spreadsheet

Post by chrisb »

Just for convenience: clicking the recompute icon reenables subsequent recomputes as well.

Edit: This is no longer true in 0.19.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: FreeCAD freezes and destroys parts when changing anything in a spreadsheet

Post by uwestoehr »

TheMarkster wrote: Sun Jun 16, 2019 1:25 am There is a way to mitigate this somewhat if you have a number of cells to change and don't want to wait for the recompute after each change. Right-click on the document name in the tree and select "Skip recomputes".
Many thanks for this hint. I tried this but this is not what I need. I need of course the recomputations - in case I changed something to be calculated. So if I change a value in a spreadsheet to a cell that is referenced in a dimension I want recalculation. If I change text in a spreadsheet cell or if I write the first time something into a spreadsheet cell, there is nothing to be recomputed and thus I don't want a recomputation.

In my opinion what I want is not a convenience but a resource issue. The example I provided needs here about 20 seconds to recompute but I have more complex geometries. So it is a no-go in terms of workflow to be forced to wait a minute for just because I e.g. write a comment to a spreadsheet cell.
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreeCAD freezes and destroys parts when changing anything in a spreadsheet

Post by wmayer »

A few years ago we had a similar problem in the sketcher where for each change a recompute was done. For larger projects this quickly became a problem because a recompute easily took a minute or more.
As consequence all invocations of a recompute has been removed from the code and now it's either done if the user manually clicks the Refresh button or when he leaves the sketch.

So, we should do something similar for the Spreadsheet.

Btw, I found a weird behaviour:
when I tmp. disable the automatic recompute of a document and change the content of a cell then it shows the old content as soon as I leave it. But after doing a manual recompute it shows the new value.

So, feel free to open a ticket for a feature request.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: FreeCAD freezes and destroys parts when changing anything in a spreadsheet

Post by uwestoehr »

wmayer wrote: Mon Jun 17, 2019 8:58 am So, we should do something similar for the Spreadsheet.
So, feel free to open a ticket for a feature request.
Many thanks for having a look. I fully agree with you and opened now issue #4024.

wmayer wrote: Mon Jun 17, 2019 8:58 am I found a weird behaviour:
when I tmp. disable the automatic recompute of a document and change the content of a cell then it shows the old content as soon as I leave it. But after doing a manual recompute it shows the new value.
I see this too. This is in my opinion a bug. Should I report this or will you do this?
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: FreeCAD freezes and destroys parts when changing anything in a spreadsheet

Post by chrisb »

wmayer wrote: Mon Jun 17, 2019 8:58 am So, we should do something similar for the Spreadsheet.
This would be great, but it would require quite some redesign of the GUI, because the spreadsheet is opened in its own tab, while Sketcher hast its task panel which has to be confirmed explicitely.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply