The following script creates 2 spreadsheets, the first one gets a custom label, and the second one is created with that very same string as the name:
Code: Select all
import FreeCAD
import Part
doc = FreeCAD.newDocument('labels')
s1 = doc.addObject('Spreadsheet::Sheet', 'Spreadsheet')
s1.Label = 'SetupSheet'
s2 = doc.addObject('Spreadsheet::Sheet', 'SetupSheet')
s2.set('A1', '3 mm')
s2.setAlias('A1', 'Height')
doc.recompute()
box = doc.addObject('Part::Box', 'Box')
box.setExpression('Height', "%s.Height" % s2.Label)
doc.recompute()
It adds an alias to the second spreadsheet, creates a box and sets an expression for one of its properties - referencing the alias in the spreadsheet. The Tree looks like this:

- original-tree.PNG (4.97 KiB) Viewed 1993 times
Now if you safe that document and load it again the Tree changes to this:

- reloaded-tree.PNG (4.13 KiB) Viewed 1993 times
And the expression on Box.Height is broken because it still references "SetupSheet001.Height" which of course doesn't exist because it should now be "SetupSheet002.Height".
It would probably be worse if first spreadsheet also had an Alias "Height" - in which case the expression would be valid and that little box might not be as little anymore.
Anybody got an idea on how to fix this?