Category Archives: life

Programmatically rescaling and manipulating the darts in sewing patterns

I’ve been playing with the tmtp project for programmatically generating SVGs based on body measurements in order to create basic blocks and sewing patterns (see my previous blog post). I’m not yet at the point of being able to look at an image and see if it will sew correctly. However, printing and taping up large patterns is frustrating and a waste of paper. Scaling the patterns down so that they fit on a single page of paper makes perfect sense. With the measurements I’m working with, a scale of 0.2 (1″ : 5″) makes things fit neatly on 8.5″x11″ paper. It’s easy enough to cut them out and tape them up into something that resembles the form.

Here’s the commit that adds the scaling factor, and the commit that adds a very useful --scale command-line option. This lets me do something like this:

python mkpattern --verbose \
  --client=customer/Sacha/sacha-cm.json \
  --pattern=patterns/dart_manipulation_example.py \
  --styles=tests/test_styles.json --scale=0.2 output.svg

I generated a bunch of SVGs using my measurements, printed and cut them, and taped them up. Tada! They look like they make sense. The easy-fitting bodice block from Metric Pattern Cutting is, as expected, looser than the close-fitting bodice block, and both are a little bit bigger than the basic bodice block from BurdaStyle.

2015-10-26 16.17.312015-10-26 16.20.17

The basic shirt pattern from Cal Patch’s Design-it-Yourself Clothes fits over the basic blocks, as expected. It looks a little boxy compared to the blocks, but it will probably be fine in cotton, since cotton won’t be as stiff as paper.

2015-10-26 16.18.49

If I end up doing this a lot, I’ll probably look into modifying the patterns to draw an outline on a separate layer. Then I can convert the SVG for use with Hacklab’s laser cutter (see my previous experiments and fun results), so I can easily test with paper or fabric.

I was thinking about the viability of printing a small, to-scale 3D model based on measurements. Doesn’t have to be a photorealistic 3D scan of me – apparently you can get photorealistic 3D prints for about ~$120 these days, but that’s still a bit much. If it’s not from a scan, though, there’s the challenge of generating a good model based on entered measurements, or creating/adjusting an existing model of a dress maker’s mannequin. Anyway, papercraft with basic blocks seems to be a decent starting point. =)

With the scaling factor in place, I did the math for dart manipulation. Darts help add shape to fabric, turning flat pieces into slightly conical structures. If you wanted to move a dart on paper, you could tape the dart closed, then cut a new line to the apex of the dart and spread the pattern until it’s flat again. (Wikipedia describes this as slash-and-spread.)

There’s an SVG rotate transformation that would probably make it easier to handle the rotation of complex shapes. I haven’t figured out how to add an SVG group in tmtp yet, though. Instead, I:

  1. Added a pair of points where my “cut” was going to be
  2. Calculated the existing dart angle
  3. Rotated one of the dart points, one of the new cut points, and the points in between – to make things easier, I specified which points to rotate
  4. Redrew the front bodice

I added a few library functions, so now the code to rotate a dart is pretty short. It takes an array defining the dart points (start, apex, end), and another array of the points to rotate around the apex by the calculated angle.

def rotateDart(self, dart_points, points_to_rotate):
    # Determine the angle of rotation
    angle = angleOfVectorP(dart_points[0], dart_points[1], dart_points[2])
    # Rotate the dart closed
    (dart_points[0].x, dart_points[0].y) = rotateP(dart_points[0], dart_points[1], angle)
    # Rotate the rest of the points
    for i in range(len(points_to_rotate)):
        (points_to_rotate[i].x, points_to_rotate[i].y) = rotateP(points_to_rotate[i], dart_points[1], angle)
    return

When I printed out my test pattern and cut it, the new pattern matched the result of slashing and spreading the dart on the previous bodice. Hooray for paper testing!

2015-10-26 18.27.54

The next step would probably be to make an SVG slicer that converts large patterns into segments that can be printed on a home printer. It would probably move/clip the image, add cutting lines and labels for convenience, and export a series of SVGs. If I’m lucky, I might be able to find a Python library that will let me easily create a multi-page PDF.

More thoughts on sewing and programming: it would be nifty to be able to easily program variable seam allowances, so that I could say that one seam has a 1/2″ allowance and the other has a 2″ hem allowance. Lines should be pretty straightforward – just offset a parallel line by the specified distance. Bezier curves might be a challenge. In “An offset algorithm for polyline curves” (Liu, Yong, Zheng, and Sun, 2006), the authors describe a algorithm involving trimming the offset curves of a polyline curve. I should check out the approximation algorithms mentioned in their literature review – might be an easier thing to start with, especially if I can wrap my head around the way the existing code’s curveLength function interpolates curves. Or I can leave the addition of variable allowances as a human step. It’s not that hard with a seam allowance ruler. Still, it would be neat to have laser-ready SVGs… =)

Anyway, now that I’ve got a simple way to test things on a small scale and a bit more of a handle on the math, I’m looking forward to playing around with generating actual patterns instead of just basic blocks. Whee!

Fabric from the thrift store

I’ve been raiding the thrift store for 100% cotton sheets with patterns or textures that appeal to me. After a trip through the washing machine and dryer, they’re ready to be turned into other things. It’s easier to imagine what they’ll wear like with the softness of well-washed cotton instead of the stiffness of fabric on the bolt. There’s so much fabric that it’s easy to take risks on sewing experiments without feeling like I need to worry too much about maximizing yardage or avoiding mistakes. At the moment, I’d rather buy fabric than finished clothes, if I think I can sew what I want. Every piece is an opportunity to learn something.

Value Village is a bit higher-priced than the other thrift stores, but it has the advantage of being the largest one within walking distance. The price differences aren’t large enough to justify going on the subway. My limiting factor for sewing certainly isn’t a lack of fabric in my stash!

It took me a while to realize that I could get lots of material from the thrift store instead of from the fabric store. When I started getting back into sewing last year, I sewed the same pattern in different solid-coloured fabrics, and then moved on to some of the patterns that I liked: gingham, floral, and even a Marvel Comics print. (Mwahaha!) The more I browsed through the selection at fabric stores, though, the more I felt that I didn’t need to find a specific print or colour in order to make something I would like. If I happened across something I liked at the thrift store, I could add it to my stash. If not, it was a good walk anyway, and there’s still more to sew beyond that.

I suppose it’s a little like how we plan our groceries around the weekly flyers. If diced tomatoes are on sale, then it’s a good time to stock up. If not, we can cook from storage. If we’re out, there are plenty of other things we can cook.

I’m now reasonably confident that I can turn fabric into something simple that I can comfortably wear, and that I might prefer wearing more that something I could buy either used or new. I’m also happy with the kind of fabric that I can easily get, with the occasional splurge or special order here and there. I could spend more – there’s room in my budget, considering it’s part utility, part entertainment, and part education – but I don’t need to, and I like not needing more.

Learned how to replace a zipper

One of W-‘s winter jackets had a zipper that started to separate at the bottom. In retrospect, I should’ve tried squeezing the slider with pliers to see if that simple fix would take care of it. Then again, W- had probably already tried that before checking out zipper replacement tutorials on Youtube. Besides, replacing the zipper would also let us swap out the coil zipper for a plastic molded zipper (or what YKK calls Vislon zippers), which W- wanted.

There’s a tailor near us that charges $1/inch for replacing zippers, but I figured I’d give it a shot first. Free opportunity to learn a potentially useful skill, after all. I used a seam ripper to open the zipper-related seams. One of the sides came apart pretty quickly, but the other side required reaching through the lining of the jacket in order to loosen a few stitches before I could cut the rest of the threads.

Since I had the lining open anyway, I figured it was a good time to unpick the over-zipper flap’s hook-and-loop tape segments so that I could replace them with snaps. (Velcro is not a good idea when you have three cats.)

Yesterday I went on a long walk downtown to pick up supplies, since the fabric warehouse near us didn’t have the zippers or snaps I was looking for. I wasn’t sure what length to get and I forgot to bring the old zipper along, so I bought a 24″ zipper and a 26″ zipper from Fabricland – both one-way separating locking plastic moulded zippers. I bought rust-resistant snaps from a small store on Queen Street near Spadina.

I spent most of today learning how to replace the zipper. I took the time to baste both sides, which worked out well. I was a little concerned about the holes for the bottom snaps letting in wind and water, so I hand-sewed some polyurethane film behind the bottom snaps to catch some of that. My machine-stitching was a little wobbly because of the thickness, and there were parts I still needed to hand-stitch with the help of a thimble. Maybe next time I might hand-stitch the whole thing so that I can line things up better. The underside of my machine-stitched zipper wandered a bit. Still, I’m sure W- won’t mind!

Sewing the zipper and installing the snaps took me about five hours, but I’m sure that will get faster with practice. It was good to see things take shape, and the time passed quickly enough with Youtube videos in the background. I might take future zippers to the tailor if I’m pressed for time. Today, though, it was good to cross off another unexpected addition to my bucket list. =)

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

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

Bubble tea and tapioca pearls

We’ve been on a bubble tea kick at home, inspired by Peaceful Cuisine’s video.

Well, W- and J- have been having bubble tea. I’ve been enjoying my allotment of tapioca pearls in ginataan along with some bilo bilo (glutinous rice flour dumplings). Yum.

The only supermarket that carries tapioca pearls near us is a short drive or a 40-minute walk away. While browsing through the bulk food store that’s closer to us, W- discovered that they carry tapioca starch. It turns out that all you need to do is add 1/3 cup of boiling water to 1 cup of tapioca starch, knead it until it’s a smooth dough, and make whatever shapes you like. Here’s the video I picked up the instructions from:

A package of tapioca pearls is $2.39 for 250g, or $9.56/kg. The store-bought pearls contain food colouring and other additives. Tapioca starch was on sale today at $2.78/kg, and the regular price is $3.27/kg. Kneading the tapioca dough and rolling it into small spheres was fun and relaxing, so even the labour is worth it. Besides, it’s nice to know that even if I’m not near an Asian supermarket, I can make these little treats.

2015-09-26 19.09.29 2015-09-26 19.08.58

The bulk food store also carries soy milk powder, so we were joking about stocking up. That way, in an emergency situation, we can still have bubble tea. Bwahaha!

Hmm. Now I’m tempted to experiment with making soy milk from soybeans – these instructions look pretty straightforward…

Making things around the house

After what felt like a couple of months of brain fog, I’m slowly starting to feel more like myself again.

We finished two major house TODOs: basement tiling and bathtub reglazing. W- spent a long time grinding the uneven basement into some semblance of plane. He wanted to keep the slope for drainage, so self-leveling cement wasn’t a good fit for us. Anyway, once that was sorted out, I helped W- tile the laundry area and bathroom in the basement. Between Youtube and various DIY/contractor forums, we figured out what to do with our floor. It feels really nice and solid now, and we’ve been able to move the laundry machines in. W- also painted and reinstalled the fixtures in the basement bathroom, and we managed to pull everything together a day before the deadline set by our bathtub reglazing appointment. The contractors for that one needed to block off the upstairs bathroom for two days, so it was good that we managed to get the backup bathroom online!

Anyway, it’s been great being able to do laundry at home again. We’d been taking must-wash items to a nearby laundromat, but the rest of the lower-priority things had been piling up. Not only did I go through quite a few loads, I was able to finally pre-wash the fabric I’d bought for some sewing experiments. Once I set up the sewing machine and serger on my desk downstairs, I got to work on converting a thrifted bedsheet into a long drawstring skirt, and on making various small necessities with the cotton flannelette that I’d bought a few weeks ago.

In other news, the recent Emacs Conf was tons of fun. I’ve downloaded the Twitch videos and will start splitting them up into individual presentations. If the on-site organizers figure out a good way to send me the backup videos they took, I’ll splice in some of those shots to help set the stage and compensate for technical difficulties.

We still have a bit more to do downstairs, such as figuring out how to transition between cut-slightly-too-short carpet on an uneven floor and the much more even tile. The carpet’s higher than the tile, and it looks like most carpet-to-tile transitions assume the opposite. The carpet doesn’t seem quite long enough to stretch, either. Ah well. It’s held down by duct tape at the moment, which is classic in its own way.

Once the basement and the bathroom are sorted out, we’ll finally get to clear out the stuff that we’d temporarily moved into the living room. It’ll be nice to let that space breathe again.

I’m also looking forward to organizing my fabric stash and turning some of them into projects. I’d like to pick up some more fabric for projects, too. I still find sewing frustrating from time to time – especially when I try to go faster than I can – but I feel it slowly becoming something enjoyable in its own right. I like exploring the patterns and textures. I love making simple, ordinary things, since that means I get to enjoy a little extra infusion of memory and satisfaction in my everyday life.

In terms of tech, I’m glad I’ve been able to continue consulting throughout this. I find programming easy to do when it’s more like a conversation with other people, figuring out what they want and adapting the tools to them. When I’m fuzzy-brained, it’s difficult to come up with something on my own. I look forward to dusting off my Emacs configuration and exploring the neat ideas I picked up from the conference, though, and writing more blog posts about what I find.

I’m also looking forward to blogging more often, and to moving my weekly review back to the weekends instead of letting it creep to the following Friday. =) I’m sure that as I get back into various interests, I’ll be overflowing with notes to write and share. Someday I might even respond to the e-mails languishing in my inbox.

So that’s what life has been like for the past couple of weeks or so. Onward!