Monthly Archives: December 2012

A cookie-cutter blog post

bread

It lightens my heart to know that Nikolaus Gradwohl has dedicated some of his time to producing a piece of software that generates 3D models of cookie cutters. I stood on his gigantic shoulders to make these Gingerzombies first on my Replicator and then in my kitchen.

I do almost all of my 3D work in Maya 2009. Once or twice I’ve hopped over to OpenSCAD, but for these models I used a little piece of free software called, appropriately, the Cookie Cutter Editor.

I started the process in Photoshop with a pair of gesture drawings.

gesture

And then filled out the gestures to make outlines of gingerbread men. While doing this one has to keep in mind how the final product is going to cut from moist dough and bake, so a little modification of the pose was necessary. The pose also has to read in silhouette to maintain the illusion of life.

trace

Next, bring the drawing into Maya and trace it with a polygon. We can skimp on the geometry a little because the outline will blorp out in the baking anyway. Then extrude, and we’re good, right? Easy peasy mac and cheesy.

maya_runner

Not so, alas. Take a look at these self-intersecting extrusion edges– it’s a common plague for me with modeling in Maya. The image on the left is a small edge extrusion, but once one extends the extrusion out, tight corners begin to intersect and produce unusable geometry.

extrusion

You could go through and merge those vertices, but it can get pretty tedious, especially with a complex model.

So I downloaded Cookie Cutter Editor, imported my drawings, and started tracing. Cookie Cutter Editor isn’t fancy, but it is very easy to use and it does the job.

cceditor

The only problem with it is the way one places vertices; you don’t connect the dots by drawing in sequence, but rather by adding vertex between two existing vertices. I don’t see a way to specify which two verts are the endpoints, so one ends up moving a lot of vertices around to follow a complex outline like a gingerzombie. This could take a very long time.

What to do? I’ve already drawn the cutters in Maya, so I just have to get the data from Maya to Cookie Cutter editor. This seems like a lot of work for a pair of cookie cutters, but now I have a problem to be solved, and that’s way more interesting than cookies.

In fact, forget the cookies, this is now a data manipulation project.

First I have to see what kind of information CCE puts out. I made a squarish cutter and exported the data.

square

Which exports the following:

414.0 65.0
427.0 404.0
76.0 408.0
76.0 62.0

Space-delimited Cartesian data separated by carriage returns. Love this. If you ever want to put something in my stocking for Christmas, get me a properly-formatted text file.

It looks like the minimum and maximums on these are 0 and 500 pixels, and CCE draws its polygons clockwise. That should be easy enough.

After a few minutes of fiddling, I have this MEL script. (MEL is Maya’s internal programming language. It’s really useful for automating repetitive tasks.)

proc export(){

$foo=”meshname”;

int $i=0;

# change 156 below to the number of verts in the mesh

for ($i=0; $i<=156; $i++){
$vert=$foo+".vtx["+$i+"]";

$loc=`xform -ws -q -t $vert`;
print ((int($loc[0]*10))+".0 "+int($loc[2]*10)+".0n");

}

}

export()

This is ugly, ugly code, folks. Some kid just starting out could get hurt on this stuff, so don’t use it as an example of how to write MEL scripts.

A quick copy/paste from Maya’s editor into TextEdit and CCE’s import looks like this:

runner_CCE

The export is a single keystroke and then I’ve got an STL file. netFabb doesn’t like it. The red polygons are suspicious for some reason. It’s also flipped left to right.

runner_netFabb

So I bring it back into Maya to take a closer look.

intersecting

Huh. Intersecting polygons. Exactly what I was trying to avoid when I started this process.

Phooey.

The goal here isn’t to produce a watertight mesh, it’s to get a working cookie cutter in the physical world, so let’s see what ReplicatorG will do with it.

runner_repG

ReplicatorG is the Honey Badger of slicing software. ReplicatorG don’t care. ReplicatorG’ll slice anything. Usually these slices print just fine, but in this case here’s the real-world result of intersecting geometry.

slicing_error

It’s certainly usable, but it’s a little weird and ugly. Here’s the final print:

gingerzombies

Download the models here from Thingiverse. Merry Christmas.

/dev/random

temp_1355386246

/dev/random is my new comic. It updates Mondays, Wednesdays, and Fridays: watch this space.

The creative core of the comic is a Python script that scrapes other websites for content and uses ImageMagick to munge them into a graphic. Sometimes the result is bizarre, sometimes it makes sense, and sometimes it’s genuinely funny.

Every online community has a distinct bouquet. Character 1 is generated by mining Thingiverse for a single sentence in a Thing’s print instructions. This text is usually earnest, if noncommittal and sometimes a little inside-baseball with regard to 3D printing technicalities.

Character 2’s responses are drawn from the 4chan Reddit, which like its namesake tends towards drivel, CAPS LOCK, and invective.

If you’ve never heard of 4chan, you might not want to click on that link.

This is classic Straight Man/Wise Guy juxtaposition. And if you do it enough times, even a computer can get it right.

The long-term idea is to shepherd the comic along, introducing new features that I hope will increase teh funny-to-crap ratio. I gots plans, mang.

For now, it’s two talking rectangles.

There is another comic out there called /dev/random, but it looks like that particular creative well ran dry in 2006. It’s too good a name to let bitrot, so I’m grabbing the ball and running with it.

About 75% of the generated cartoons are nonsense or script failures. I leave these on the cutting room floor.

temp_1355158614

By coincidence, some make sense as a conversation between two characters. Most of these aren’t funny.

temp_1355443226

Every now and then an unexpected result is smirkworthy.

temp_1355145057

Is the bar for entertainment set so low that even a bad programmer can use other people’s content to provide the world with a moment of autogenerated mirth?

I dearly hope so.

I will never match Jim Davis in creativity or distribution, but I’ll make up for it in VOLUME, yo. There’s no way that man can sustain generating one comic every 10 minutes. HE HAS TO SLEEP SOMETIME

/dev/random is distributed under an Attribution 3.0 Unported License. (CC BY 3.0) Enjoy.