May 2, 2026
Description
This project consists of a python script that uses scipy's SHGO algorithm to optimize spiral torsion spring geometry, and a parametric FreeCAD file that takes the outputs from the optimizer and generates a 3D model of the optimized spring. You can run the optimizer yourself on my website or get the python code on my github.
After clicking "Copy all values" on the optimizer on my website, open the parametric model in FreeCAD, and then open the "par" spreadsheet. Under the "Import from Optimizer" section, select field B2 and then paste. It will paste the whole column of outputs into each input from B2 to B8 automatically. Do not change anything in the "Center Pad Calculations" section, it is making those calculations from the same inputs you just pasted in.
The spring is composed of a spiral primitive (Spring Spiral) and a profile normal to the inner end of that spiral that is swept across it. This is better than using a profile normal to one of the axial planes and revolving it around origin because the profile of a spiral is never coplanar with origin at any point.
The center pad is where it gets interesting. In order to maximize the strength of the connection with the center axis or whatever will be constructed there, I use a spiral that starts at one corner of the inner end of the spring and winds around origin until it connects to the other corner. In the "Center Pad Calculations" section of the spreadsheet, these corners of the inner end of the spiral are referred to as point a and point b.
From these points, the spreadsheet calculates all of the necessary parameters for the inner spiral which becomes the center pad.
The only known limitation to this CAD file currently is that it cannot accept an extremely large minimum coil gap input. This is because of the inner spiral. As long as a_theta stays below 90°, it will work. To break it in this way, you need a truly ridiculous minimum coil gap. If you find any inputs that break the model, please let me know and I will try to fix it.
License:
Creative Commons — Attribution — Noncommercial — Share Alike