This can actually also be used in this context. But after changes to the 'spreadsheet' file, only the spreadsheet 'Link' in the 'model' file is marked to be recomputed. So the user would have to remember to additionally recompute the whole 'model' file.
recompute() is slow, how do I do it less?
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
Re: recompute() is slow, how do I do it less?
Re: recompute() is slow, how do I do it less?
Thank you very much, that's the best solution so far!Roy_043 wrote: ↑Tue Jul 28, 2020 1:19 pm You can use the following syntax to reference values from an external file.Code: Select all
NameOfOtherFile#NameOfSpreadsheet.Alias
I made a script to quickly update all references to a local spreadsheet to point to the same cells from the spreadsheet of another file.
Replace "data" by the name of your spreadsheet file and both "Spreadsheet" by the name of your original and new spreadsheets:
Code: Select all
for obj in FreeCAD.ActiveDocument.Objects:
for expTuple in obj.ExpressionEngine:
newEE = re.sub(r'(^|[^#])Spreadsheet',r'\1data#Spreadsheet',expTuple[1])
print ('Setting ' + expTuple[0] + ' of object ' + obj.Label + ' to ' + newEE)
obj.setExpression(expTuple[0], newEE)