Pattern-making: Generating SVGs for sewing with Python and tmtp

Posted: - Modified: | geek, sewing

I like sewing simple clothes, and I’d like to be able to continue doing that even as measurements change without having to rely on commercial patterns that would need to be manually adjusted anyway. I also want to experiment with computer-assisted cutting, like the way the laser cutter at Hacklab.to made it super-easy to precisely cut the same top in different fabrics.

In sewing, there’s the idea of drafting a pattern based on a set of measurements and a few calculations. You could do this with a large roll of paper, a ruler, and some way to draw a smooth curve (French curves, hip curves, or even tracing around the edge of a plate). There are software programs to do this as well, but the commercial ones tend to cost a lot if you want one that automatically drafts the rest of the pattern based on your measurements. Still, you can translate the manual instructions to digital form by drawing the appropriate lines and curves in a vector drawing program such as Inkscape or Adobe Illustrator.

While researching open source options for pattern-making, I came across Tau Meta Tau Physica (tmtp). At its core, it’s a Python script that produces an SVG based on a programmed pattern and a set of measurements. With a little fiddling (downgraded pySVG, fixed some case sensitivity issues), I got it working on my system.

Both documentation and actual code samples were pretty sparse, but I figured out the basics by reading the library code and the test patterns. I spent the day working on translating some of the basic patterns from Cal Patch’s book Design-It-Yourself Clothes: Pattern Making Simplified. So far, I’ve put together plausible-looking replicas of the A-line skirt and the basic shirt.

One of the nifty things about writing programs to draft patterns is that I can use the library functions to calculate the lengths of the cubic Bezier curves I’m using for necklines and armholes. This is handy when calculating collar length or adjusting sleeve caps. In particular, it’s neat to be able to use a loop to adjust the sleeve cap by offsetting the bicep point, although I’ll probably tweak the algorithm because it might be good to balance that with other ways to adjust that sleeve cap length.

I still haven’t tested the patterns, though, and I’m not even sure I’m collecting all these measurements correctly. At some point, I’ll print them out and sew a muslin yet. It would be good to test the sleeve cap. But the patterns look reasonable, so that’s a start.

Here are some screenshots based on my current measurements, and some links to the patterns on Github:

A-line skirt: My default measurements have this skirt sitting at my natural waist, although I’ll probably drop the waistline a bit lower before sewing it.

2015-09-29 20_57_39-foo.svg

Basic shirt: Totally untested. Would be interesting to see if this sleeve actually works, or what needs tweaking.

2015-09-29 20_59_55-_foo.svg - Inkscape

I’ll work on encoding the Burda bodice block, and then I can use that to sanity-check the shirt. Then there’s figuring out poster printing, taping up the pattern, and trying it out. Looks promising, though! I’m still boggled that the math I did for squaring lines seems to actually work. Now if only I can figure out proper seam allowance calculations instead of leaving that as a post-processing stepĀ in Inkscape or on paper…

My Github fork of tmtp

You can comment with Disqus or you can e-mail me at sacha@sachachua.com.