Some test about new Spreadsheet WB

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: Some test about new Spreadsheet WB

Post by ickby »

Hallo,

when using an alias for a cell wich holds a value with unit and then using the alias in an equation the unit is not displayed.
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: Some test about new Spreadsheet WB

Post by cox »

Can no longer pad my sketch, when trying I get "Please create a sketch or 2D object first"

In my file i created the sketch after making the spreadsheet.

There is an error in the spreadsheet at cell A10, even after clearing this cell I still have problems.

I also have truble deleting the spreadsheet. Had to close the spreadsheet view before i could delete it.

After deleting the spreadsheet i could pad my sketch.

I can not seam to reproduce this, but I hope my file might shed some light on a posible problem.

OS: "Arch Linux"
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4572 (Git)
Branch: master
Hash: be2bb52796ae1be001882da114e8272c4c746af0
Python version: 2.7.9
Qt version: 4.8.6
Coin version: 3.1.3
OCC version: 6.7.1
Attachments
Spreadsheet.fcstd
(2.93 KiB) Downloaded 36 times
Need help? Feel free to ask, but please read the guidelines first
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: Some test about new Spreadsheet WB

Post by eivindkvedalen »

ickby wrote:Hallo,

when using an alias for a cell wich holds a value with unit and then using the alias in an equation the unit is not displayed.
Hi,

This was supposed to work by using the Property::Paste function. Now it turns out that PropertyQuantity::Save/Restore/Copy/Paste/getMemSize are all unimplemented, and thus inherits from PropertyFloat. This means that the unit information is lost during undo/redo, but also when saving to file, if I read this correctly. I presume this is not the intended behaviour, and needs to be fixed in the PropertyQuantity class. I'd prefer not to do that myself, because such a change needs to be fully backwards compatible, etc.

Eivind
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: Some test about new Spreadsheet WB

Post by eivindkvedalen »

cox wrote:Can no longer pad my sketch, when trying I get "Please create a sketch or 2D object first"

In my file i created the sketch after making the spreadsheet.

There is an error in the spreadsheet at cell A10, even after clearing this cell I still have problems.
In cell A10, sketch constraints are unfortunately not exposed as properties like you assume. Support for this is a much more invasive code change, and will at best be supported in 0.16, I presume.
cox wrote: I also have truble deleting the spreadsheet. Had to close the spreadsheet view before i could delete it.

After deleting the spreadsheet i could pad my sketch.

I can not seam to reproduce this, but I hope my file might shed some light on a posible problem.
I can recreate your problem here with your file, which is good, but this will take some time to investigate.

Edit: The Pad command validates that the sketch is not used by anyone else. This is why the pad command fails. This will be a problem that needs to be resolved when constraints can be queried. In addition, the dependency list is currently not properly maintained in the spreadsheet module, so deleting the cell doesn't help. I'm working on a fix for that.

Eivind
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: Some test about new Spreadsheet WB

Post by eivindkvedalen »

ulrich1a wrote:I got another minor issue:
1. Make a new document with a spreadsheet.
2. Add two numbers in two cells.
3. Add a formula with the two numbers in a third cell.
4. Save the spreadsheet.

Issue: the formula result turns into #ERR.
You need to close the document and open it again to see the right result.
This is basically the same problem as rockn sees; relabeling the document after a save changes its name, and it turns out that I haven't consistently used either its internal name or the Label. I have a fix for that locally now, but I'd really like to also test FreeCAD with a different language before pushing this change.

Eivind
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: Some test about new Spreadsheet WB

Post by cox »

eivindkvedalen wrote:I'm working on a fix for that.

Eivind
Thank you for the awesome work you do :-)
Need help? Feel free to ask, but please read the guidelines first
User avatar
rockn
Veteran
Posts: 1791
Joined: Wed Sep 28, 2011 10:39 am
Location: Toulouse, France
Contact:

Re: Some test about new Spreadsheet WB

Post by rockn »

CkwA wrote: Edit: After some test and restart, now the spreadsheet updates correctly even in French ...
Always ? even in a new doc ?

I made more test about this :
The original problem :
Start FC in French
New Doc
Create a Box and a Spreadsheet
Set A1 = Box.Shape.Volume
Change Box Length
Cell Refresh Failed

Start FC in French
Change lang to English
New Doc
Create a Box and a Spreadsheet
Set A1 =Box.Shape.Volume
Change Box Length
Refresh Ok
Save File
Change Box Length
Refresh Fail
Close FC

Start FC still English
Open previous saved File
Change Box Length
Refresh Ok
Change lang to French
Change Box Length
Refresh Ok
Save
Refresh stil Ok
Save As...
Change Box Length
Refresh Failed
Close FC

Start FC in French
Open Previous File
Cell refresh Ok
Make a new doc, new Box, new Spreadsheet
The original problem still here.

Code: Select all

OS: Ubuntu 14.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4572 (Git)
Branch: master
Hash: be2bb52796ae1be001882da114e8272c4c746af0
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.1.oce-0.16
Formations - Assistance - Développement : https://freecad-france.com
CkwA
Posts: 59
Joined: Fri Sep 12, 2014 6:37 pm

Re: Some test about new Spreadsheet WB

Post by CkwA »

rockn wrote:
CkwA wrote: Edit: After some test and restart, now the spreadsheet updates correctly even in French ...
Always ? even in a new doc ?
No it doesn't work in a new doc.

To do it working i do this :
(With language set to French)
- Create the file, the box (Part workbench, Box tool)
- Save the file
- Restart FreeCAD < This step is important
- Open the file
- Create the spreadsheet and set A1 = Cube.Shape.Volume (Cube is the label of the box)
- Now spreadsheet update correctly if i made change on the box properties, even after restart FreeCAD.

I don't know what to do to help more.

-- FreeCAD Infos --
OS: Ubuntu 14.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4572 (Git)
Branch: master
Hash: be2bb52796ae1be001882da114e8272c4c746af0
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.1
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Some test about new Spreadsheet WB

Post by ulrich1a »

I started to use the spreadsheet with python. The good news is, it worked nearly as expected, but there is a difference between manual input and filling cells with python. Filling a cell with python requires for each cell a recompute of the document, otherwise the filled cell will not be updated. Other cells referring to such a not updated cells are giving an #Err-result.

The script itselfs will also ends with an not very helpful error message.

Here is my script for testing purposes.

Could the set-method be changed, so that it updates the cell content?

Ulrich
Attachments
faculSpread.py.zip
(805 Bytes) Downloaded 37 times
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: Some test about new Spreadsheet WB

Post by eivindkvedalen »

ulrich1a wrote:I started to use the spreadsheet with python. The good news is, it worked nearly as expected, but there is a difference between manual input and filling cells with python. Filling a cell with python requires for each cell a recompute of the document, otherwise the filled cell will not be updated. Other cells referring to such a not updated cells are giving an #Err-result.

The script itselfs will also ends with an not very helpful error message.

Here is my script for testing purposes.

Could the set-method be changed, so that it updates the cell content?

Ulrich
Hi,

By design, the spreadsheet does not recompute itself after each insert. This is because recomputes can potentially be expensive, but another reason is that this is how freecad works also with e.g part design; an explicit call to recompute is needed. In the gui this is added automatically for each command or interaction.

btw, it is enough with one recompute at the the end of your script; all cells containing an error will be retried to resolve them. Also, depenencies are tracked so they are recalculated in order.

The extra message you see is a bug. Fixed locally, but not pushed.

Eivind
Post Reply