I'm new to this forum, so please apologize if I should transgress one or the other rule concerning new posts. I have the feeling I found a bug in FreeCAD, so I would like to discuss it on the forum to make sure it is really worth reporting it in the tracker. After searching the forum and the tracker I could not find this subject (I hope I did not miss anything), that's why I'm starting this new discussion.
First this is my FreeCAD version (it should be the most recent one):
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13541 (Git)
Build type: Release
Branch: releases/FreeCAD-0-17
Hash: 9948ee4f1570df9216862a79705afb367b2c6ffb
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: French/Switzerland (fr_CH)
Summary: I'm having trouble defining constraints with formula in "Sketcher". It is possible to define constraints based on formula containing named values defined in a spreadsheet, but these formula are not saved, and hence when re-opening the file, the formula will have disappeared (replaced by their last value), and hence any change in the spreadsheet values will not have any effect on the 3D geometry.
Details: Those are the steps to reproduce the problem from scratch (sorry for the rather lenghty description, but you should be able to go through it in a few minutes only). Maybe one or two keywords are not exactly as in the english version of FreeCAD (I translated them from the french version), but it should be about correct:
- Start FreeCAD and create a new empty document.
- Select the "Spreadsheet" workbench, write 3 values in 3 different cells (e.g. 500, 120 and 22). Name each of these 3 cells by richt-clicking on it --> Properties --> (tab) Alias and give them the names "Board_length", "Board_width" and "Board_thickness" respectively.
- Select the "Part Design" workbench, click "Create body", then "Create sketch", choose "XY_Plane", draw a new "Rectangle".
- Select one of the horizontal sides of the rectangle, click the "Horizontal Distance" constraint, click on the blue round icon "f(x)" and enter "Spreadsheet.Board_length" in the "Length" field.
- Select one of the vertical sides of the rectangle, click the "Vertical Distance" constraint, click on the blue round icon "f(x)" and enter "Spreadsheet.Board_width" in the "Length" field.
- Look at the constraint list (left) and double-click on the horizontal constraint that was just defined. You can see that the value of the expression that was entered is correct, but the expression itself is not there any more (this is the 1st part of the bug). So click on the blue round icon "f(x)" again and re-enter "Spreadsheet.Board_length" in the "Length" field. After closing the input dialog, a message "Failed to parse expression" is shown. Click "OK" to close the message and then "Update" (left). Now the blue round icon "f(x)" is visible in the constraint list besides the horizontal constraint, and if you re-open the constraint value window, the formula is still there.
- Double-click on the vertical constraint (in the list on the left) that was just defined. Here also you can see that the value of the expression that was entered is correct, but the expression itself is not there any more. So click on the blue round icon "f(x)" again and re-enter "Spreadsheet.Board_width" in the "Length" field. After closing the input dialog, the message "Failed to parse expression" is shown. Click "OK" to close the message and then "Update" (left). Now the blue round icon "f(x)" is visible in the constraint list besides the vertical constraint, and if you re-open the constraint value window, the formula is still there.
- Leave the "Sketcher" drawing page (click on the "Close" button up left) to go back to the "Part Design" workbench and click "Pad". In the "Length" field, click on the blue round icon "f(x)" and enter "Spreadsheet.Board_thickness". Now the board you have just drawn is visible on the 3D view.
- Go to the Spreadsheet and change one of the dimensions (e.g. the width from 120 to 500) and look at the result in the 3D view: it was updated correctly. You can do the same with any of the dimensions in the Spreadsheet and it will work like a charm.
- Save your file and exit FreeCAD.
- Reopen the file you just saved, double-click on "Spreadsheet" in the tree (left) and try again changing one of the dimensions in the Spreadsheet. You will notice that the 3D view is only updated correctly when you change the board thickness, but nothing happens if you change the length or the width.
- Double-click on the "Sketch" in the tree (left) and have a look in the constraint list (left). You will see that the value of the expression that was entered originally is still correct, but the expression itself is not there any more, hence any change in the Spreadsheet does not have any effect. So it looks like FreeCAD does not save the expressions entered in Sketcher constraints, on the other hand it does it correctly for the "Part Design" dimensions (like the thickness of the board in this example).
Thank you for any input on that matter...