I'm trying to edit a value in a Spreadsheet with Python, recompute and save a document to be able to export it.
The problem is that I'm not able to see the changes after saving the document.
Here are the lines I use in freecadcmd:
Code: Select all
import FreeCAD
import Spreadsheet
doc = FreeCAD.openDocument('/path/to/my/file.FCStd')
input_sheet = FreeCAD.ActiveDocument.getObjectsByLabel('DataInput')[0]
input_sheet.A2 = 21
# If I run "input_sheet.A2" it shows "21"
input_sheet.recompute()
doc.recompute()
doc.save()
Moreover, this cell is used to give the size of a shape and the shape still has its old size.
I did the same test using the GUI python console but the result is the same, I can see that the value is changed in the spreadsheet, but the spreadsheet appears as not saved, and if I close and reopen, I notice that the new value isn't persisted.
Do you have any idea?
Thanks
My version of Freecad:
OS: Ubuntu 20.04.2 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.19.2)
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: French/France (fr_FR)