Spreadsheet -- Is there a way to deactivate graphic recompute?

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!
garya
Posts: 221
Joined: Tue Nov 20, 2018 1:00 am
Location: Ovando, MT, USA

Spreadsheet -- Is there a way to deactivate graphic recompute?

Postby garya » Sat May 23, 2020 8:42 pm

When manipulating expressions in a spreadsheet, each change seems cause a complete recompute of geometry in the graphics engine. Is there a way to turn this off and then back on? It can be very time-consuming when one is doing a lot of corrections / reorganization.
garya
Posts: 221
Joined: Tue Nov 20, 2018 1:00 am
Location: Ovando, MT, USA

Re: Spreadsheet -- Is there a way to deactivate graphic recompute?

Postby garya » Sat May 23, 2020 9:44 pm

Thanks. I didn't know about the skip recomputes option, but unfortunately it isn't helpful in this case. As pointed out in the article, I need recomputes to be done within the spreadsheet, but not in the overall model. There was a comment about putting the spreadsheet in its own file, but it's not clear to me how that works. For small parts it would be inconvenient but workable. But I don't see how to reference the spreadsheet from the sketch if the spreadsheet is in a separate file.
User avatar
Roy_043
Posts: 1562
Joined: Thu Dec 27, 2018 12:28 pm

Re: Spreadsheet -- Is there a way to deactivate graphic recompute?

Postby Roy_043 » Sun May 24, 2020 9:20 am

garya wrote:
Sat May 23, 2020 9:44 pm
how to reference the spreadsheet from the sketch if the spreadsheet is in a separate file
See:
https://forum.freecadweb.org/viewtopic.php?f=3&t=46614

In short:

Code: Select all

File#Spreadsheet.Alias
garya
Posts: 221
Joined: Tue Nov 20, 2018 1:00 am
Location: Ovando, MT, USA

Re: Spreadsheet -- Is there a way to deactivate graphic recompute?

Postby garya » Sun May 24, 2020 2:56 pm

Thanks. That works, but it's awkward because the hints for member names don't show up as you type; when you're in the formula editor you can't
switch to the project with the sketch to look things up. Unfortunately, that makes it unusable (for me) in practice.
OS: FreeBSD 11.3-RELEASE-p6
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.0.18.4
Build type: Release
Python version: 3.7.6
Qt version: 5.13.2
Coin version: 3.1.3
OCC version: 7.4.0.beta
Locale: C/Default (C)
kisolre
Posts: 2257
Joined: Wed Nov 21, 2018 1:13 pm

Re: Spreadsheet -- Is there a way to deactivate graphic recompute?

Postby kisolre » Sun May 24, 2020 3:39 pm

garya wrote:
Sat May 23, 2020 9:44 pm
I need recomputes to be done within the spreadsheet, but not in the overall model.
Could you give an example why? You can type your formulas, aliases, values, ... and then the single recompute will sort and update everything in one go.
garya
Posts: 221
Joined: Tue Nov 20, 2018 1:00 am
Location: Ovando, MT, USA

Re: Spreadsheet -- Is there a way to deactivate graphic recompute?

Postby garya » Sun May 24, 2020 5:39 pm

kisolre wrote:
Sun May 24, 2020 3:39 pm
garya wrote:
Sat May 23, 2020 9:44 pm
I need recomputes to be done within the spreadsheet, but not in the overall model.
Could you give an example why? You can type your formulas, aliases, values, ... and then the single recompute will sort and update everything in one go.
Working with the spreadsheet itself is fine; it's working with the model in the other file that then is a problem:

Maybe the behavior I am seeing is different from what you see. If the spreadsheet is in a separate file, when I'm typing in an expression for a sketch constraint in a different model, I can't switch to the spreadsheet to look up names for variables; and in the sketcher expression dialog I don't get the hints as I'm typing to show me what the possible variables are. When I type "File_Sp" the expression dialog shows me the hint for the "File_Specs" I have created and opened; I can select that and the expression dialog now shows "File_Specs#". But when I type "Pa" it shows me nothing, whereas when the spreadsheet is in the same file it gives me a drop-down with choices "Paper_Wid Paper_Len etc". With the spreadsheet in a different file I have to remember all the possible aliases I've assigned. So there's no way to type in the desired sketcher constraint expression short of getting out of the sketcher, switching to the file with the spreadsheet, using that to figure out the expression and writing it on a piece of paper, then switching back to the file with the sketch and adding the constraint. Then repeating the whole process for each additional constraint.

If the spreadsheet is in the same file, as I enter an expression in a sketch constraint, typing a few characters shows me the available variables with that prefix, so it's relatively easy to construct an expression referencing spreadsheet aliases on the fly. But then working with the spreadsheet is painful: If I open up a new line in the spreadsheet, the whole model recomputes. If I type in a comment in the newly opened up line, the whole model recomputes. If I type in a new formula, as soon as I hit <enter> the whole model recomputes. If I set the alias name, the whole model recomputes. On my 4 processor 16G system each one of those recomputes takes about 18 seconds for some relatively small models.
kisolre
Posts: 2257
Joined: Wed Nov 21, 2018 1:13 pm

Re: Spreadsheet -- Is there a way to deactivate graphic recompute?

Postby kisolre » Sun May 24, 2020 6:23 pm

garya wrote:
Sun May 24, 2020 5:39 pm
If I open up a new line in the spreadsheet, the whole model recomputes. If I type in a comment in the newly opened up line, the whole model recomputes. If I type in a new formula, as soon as I hit <enter> the whole model recomputes. If I set the alias name, the whole model recomputes
Because sadly (as I understand it) now the spreadsheet i treated as a single object and every change is treated as "Object changed, recompute dependencies.". If only aliased cells could be referenced then limiting the status change to those cells would help a lot. But you can also reference cells by their name. So now every cell change is potential trigger. Maybe if there was a way for the spreadsheet to know which cells were referenced and trigger changed state only on those it will be better. Not sure how hard it will be to implement "referenced" state to cells and receive that info from expression engine.
Or maybe a "introduce changes on losing focus" will be simple to implement.
garya
Posts: 221
Joined: Tue Nov 20, 2018 1:00 am
Location: Ovando, MT, USA

Re: Spreadsheet -- Is there a way to deactivate graphic recompute?

Postby garya » Sun May 24, 2020 6:44 pm

The losing-focus idea seems like a good approach, although you would want that to be the "freecad focus" as opposed to the actual keyboard focus. One often switches apps (e.g. to read mail) and then back.

Treating only aliased cells wouldn't really solve the problem. It would help, but I often change more than one aliased cell at a time. For example, when factoring previously complex expressions into common pieces that are used in more than one place, or when changing the basic approach to a problem.
kisolre
Posts: 2257
Joined: Wed Nov 21, 2018 1:13 pm

Re: Spreadsheet -- Is there a way to deactivate graphic recompute?

Postby kisolre » Sun May 24, 2020 7:08 pm

garya wrote:
Sun May 24, 2020 6:44 pm
It would help, but I often change more than one aliased cell at a time.
That is when you skip recomputes.