[Feature Request] Button to add named constraints to spreadsheet

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
Palmstroem
Posts: 135
Joined: Wed Jan 27, 2021 5:34 pm

[Feature Request] Button to add named constraints to spreadsheet

Post by Palmstroem »

I really love named constraints and the new feature to see these names in a sketch is so great.
I previously already liked to use spreadsheets with named cells as in a spreadsheet I can arrange several important measures in an order I like while in the constraints part of the properties table of the sketch they appear in the order of their creation which is not always the order I'd like to arrange them. Additionally, I can collect important measures of several sketches or properties in one spreadsheet.
So I still like to create spreadsheets with the most important measures of my construction.

Now for me, it would be very helpful when I name a constraint in a sketch if I had a button added to the "OK" and "cancel"-buttons of this little dialog to automatically add this name, value, and named cell to a spreadsheet.

This could be done by:
1. Search for all spreadsheets. If there is only one, use this, if there are more, show a selection dialog to choose a spreadsheet. If there is no spreadsheet yet, create one.
2. Add a new line in the spreadsheet maybe at line 3 (configurable) as the first line might be used for a title or whatever.
3. In this new line 3 write the name in cell B3, write the value in cell C3 and rename cell C3 to the name.
4. In the sketch.Constraint.value property write the formula MySpreadsheet.CellName instead of the value.

Now each time I use this button, I create a new line 3 in my spreadsheet with an entry that my constraint is linked to.
These new 2 cells in my spreadsheet I now can arrange wherever I like inside the spreadsheet.

I wonder if I could do this with a script or a plugin. Unfortunately, I'm not that experienced in writing such scripts yet or even programming a plugin.
Post Reply