since I like and use the Spreadsheet Workbench a lot for parametric modeling, I wrote a small script to accelerate the (quite annoying) task of setting aliases. I hope you find it useful. Since it's my first code it's very coarse, so I apologize in advance and I hope you have some suggestions to improve it!
You can find it on GitHub: https://github.com/tarihatari/FreeCAD_M ... Manager.py It allows you to:
- set aliases defined in column A to any other area of the Spreadsheet
- clear aliases set somewhere in the Spreadsheet
- move a range of aliases from one cell area to another
- Generate a fully parametric Part Family, which is thus saved in the working directory
- Insert Spreadsheet
- Define the Parameters, in column A, values wherever you want
- Save, Close and reopen the Document
- Now run the macro
- Parameters must be defined in column A, values wherever you want
- In design tables, variant names must be in row 1, so it should look similar to the spreadsheet below: - Using the "Move Alias" function you can switch to another configuration of your model by just typing in the source and target cell range, i.e. from B3-10 to C3-10
- "Generate Part Family" will run through all columns of the selected range, compute the model and save the configuration with a suffix defined in row 1. Thus your working directory will look like this, for instance: Be aware that Generate Part Family starts defining aliases in the "range-from-cells", so when you call the function there should be either no aliases set or they should be in the same Cells as the range-from-cells.
I attached here two fully parametric FC models, a simple one (cube) to play with, and a more complex model of a DIN Part, to show what is possible.
The design table of the latter was created by simply copying the values from a webshop-website, formatting in excel and thus exporting to csv.
If the models are complex, it takes quite a long time to compute all the configurations (my PC is rather old, to save the 20 files shown in the screenshot it took about 15 minutes coffee drinking ).
- works only for the first Spreadsheet inserted (not with, for instance, Spreadsheet001). I did not manage yet to set the current selected spreadsheet active for editing.