Thursday, October 2, 2014

The Secret Origin of the Wonder Woman (Cookie Cutter)

When I was toying with the idea of getting a 3d printer, I discovered that one of the main feedstocks used by home printers is a food-safe plastic. Indeed, PLA (polylactide) is made from starches and used for lightweight food containers. Our household being what it is, it was a quick jump from there to the realization that, with a bit of work, I could make just about any cookie cutter we could come up with a design for. It's just a matter of taking a 2d outline and extruding it through a third dimension. I mentioned that to my lovely and talented spouse. A 3d printer was ordered that day.

It turns out that figuring out how to go from design to cutter is actually kinda complicated, even when you've dealt with the non-trivial task of figuring out just how to make a 3d printer work. However, one can work out a pretty clear path. Here's how I do it:

Starting With a 2d Image

You need a very clean black-and-white line drawing of the image you want to turn into a cookie. The only thing you should have is the outline of the pattern you want to see: no shading, no suggestion of height or depth. You may be able to outline areas which you will later shade or otherwise model, but those features aren't part of the shape you're defining in the cutout. And the simpler the image is, the better. You're working in a medium which doesn't give you great resolution. Logos and individual letters are fine, but trying to do, say, faces or long strings of text is asking for trouble. For the Wonder Woman cutter, it started out something like this:

There are some limitations on the complexity of the shape you can use here, though I haven't quite worked them all out. Software downstream seems to object to concentric closed shapes, for example, so particularly complex items may need to be done as separate images to be reassembled elsewhere. For this cutter, the goal was to cut out the big winged-W shape and make an impression of the inner lines without cutting all the way through. This meant inner and outer portions at different heights, so I had to separate the outside W from the internal lines and process and print them separately, like this:

There are also issues specific to cookie cutters to wrangle with in design: particularly acute angles and narrow spaces will print just fine, but as with any other cookie cutter, the dough may not want to come out, and pointy bits cook faster and can brown or even burn before the center of the cookie is cooked through.

Anyway, save this as a .jpg, .png, or whatever other bitmap format you prefer.

Bitmap to Vector

The next step is to convert the bitmap, which is a bunch of individual dots on a grid, to a vector graphic, which defines relationships between a smaller number of points and is more scalable. I use Inkscape for this. Here's what to do:

0. Set the scale. It's important to use consistent units of measurement across programs. I set the unit of measurement to millimeters.
1. Use File-->Import to get the image into Inkscape.
2. Select Path-->Trace Bitmap to convert the bitmap image into a bunch of paths.
3. From the palette on the left side of the screen, click on "Edit paths by nodes" or just hit F2. This puts you in a mode to edit the paths.
4. Hit Ctrl-A to select all the paths.
5. A little up from the "Edit paths" button from #3, click the "Insert new nodes into selected segments" button at least once. That'll establish more points along all those curves. That's important, because in the next step, you'll...
6. Right along the palette across the top of the screen, click on "Make selected segments lines." Turns out OpenSCAD, the software we're using to turn the .dxf into a .stl, hates curves. Adding more nodes in #5 preserves detail you'd lose otherwise.
7. Save the drawing as .dfx

Vector to .stl

I use OpenSCAD to take the vector drawing and project it a bit through a third dimension to produce the basic cookie-cutter shape. Launch OpenSCAD and, in the panel on the left, enter a command like this:

linear_extrude(file = "filename.dxf", height = mm, center = true, convexity=1);

Replace "filename.dxf" with the path to the file you want to convert and mm with the desired height of the extruded shape in milimeters. If all goes well, you'll see a rendered version of your shape appear in the panel on the right. Select File-->Export-->Export as STL to create an STL file with your now-3d shape.

Use in Sketchup

This step may be optional, but you can use Sketchup to combine multiple .stl files, add other items based on simple geometric shapes, and otherwise refine your design. Before you start work, you'll need to go to the Extention Warehouse to get a plug-in which will allow you to export .stl files as well as import them. Once you've done that, open a template which works in millimeters; later exports may not work as you expect if you chose other units. Import your .stl file, which will appear on the origin. You can move it around, rescale it, add other objects, and so on, then export to .stl when you're done.
For example, for another cutter design (the Green Lantern logo below), I used it to add a very short but wide cylinder as a base for the cutter, necessary to keep all the bits in the middle in place, and a circle the same height as the logo I was working with to define the shape around it.

For an initial pass at this cutter, I rendered the inner and outer parts at different heights and combined them into a single .stl, with the goal of cutting (with a taller outside piece) and embossing (with a shorter inside piece) with a single object. That didn't work out so well. It printed just fine, but the dough ended up sticking to the cutter excessively, so ultimately the cutter didn't work and I had to go with printing the rendered inner and outer .stls separately.


The biggest problem I ran into during printing was that the cutter is a very wide shape, which created the classic problem of curling. The edges and center cool at slightly different rates and upper and lower layers are likewise at different temperatures. For a sufficiently long/wide but thin object, like the base of a cookie cutter as it's being printed, this means that the edges tend to pull up and way from the print bed. Putting a layer of blue painter's tape on the print bed is the first line of defense here. The plastic usually sticks to it well, and it saves you from having to chisel it off the print bed if it sticks TOO well. The problem I was running into, though, is that the plastic sticks to the tape perfectly well, but the curling is so strong that it starts to pull the tape off the print bed! I switched to a stronger brand of painter's tape (3M's exterior tape), which stuck well to the print bed, but the plastic wouldn't stick to the tape at all. However, once spritzed with some cheap hairspray (unscented Aquanet), it worked just fine. There was the slightest bit of curling at one edge, but it was essentially unnoticeable.


This is the finished cutter set (with a Green Lantern design off to the side):

While I had hoped for a single-operation cutter, the two-part solution allowed us to cut the cookies and make a good impression with them without excessive effort. The cut was clean and the impression broad enough to be nicely visible after baking. Were the cookies themselves good? Well, Wonder Woman seemed to like them.