Parametric CAD (Computer Aided Design) is designing 3d models with various parameters that can be tweaked without having to redesign an entire model. This is very convenient, especially for 3d printing, and there are many tools that allow parametric 3d modeling (OpenSCAD, FreeCAD, and some proprietary tools). However, 2d parametric CAD tools (for laser cutting, CNC routing, etc) are much harder to come by. This post is about how I set up a parametric SVG system for generating parts for a laser cutter.
- Support a standalone tool to output a svg with new parameters (no web browser/etc).
- Has support for mathematical functions like sine, cosine, etc.
- Be relatively easy to use
So instead, I decided to roll my own. I'm using Genshi with a simple python script to edit parameters. Here's an example of what this looks like:
That just makes a circle with a user-definable radius.
Here's an example of a real application of this technique being used to generate a model of a quadrature encoder:
And by changing just a few lines of code, I can get this:
The code for this is on github, if you want to make some encoders yourself :)
Overall, I've been quite happy with the technique of using Genshi to generate parametric SVG files - it's very low overhead, and I have access to all of python, should I want it.