March 2009 Archives

Clojure and Art of Illusion: BFF

Two weeks ago, the rotary program dial on my dishwasher broke. Luckily, I could fix it with two Lego parts (a Cross Axle #6 and a 16-teeth gear) initially, but the program selection experience suffered from the axle’s being too thin: it’d always bend in the turning direction until the selector would too-rapidly rotate past the point I wanted to select. Ugh.

Luckily for me, there’s a reprap at the Metalab. This is a low-cost 3d printer that can extrude parts made of ABS (the same material that Lego pieces are made of). With the help of Philipp’s MetaCADEvaluator plugin to Art of Illusion (AoI), I managed to create a very nice 3d model of a replacement for the dial. That plugin let me define parameters for each part, so I could easily resize all parts manually once I discovered that I’d mistakenly noted down each part’s diameter instead of the radius. However, this was slightly fiddly business: All editing happens inside Art of Illusion’s part name text fields, the syntax is slightly odd, and you can’t define your own part library.

Enter my urge to try out Clojure. This little side project took three steps:

  1. Find out how to embed clojure in AoI (done).
  2. Make it open a swank port so I can on AoI from emacs without having to recompile all the time (done).
  3. Build a part definition DSL (ongoing, one milestone achieved).

There’s a detailed description of these steps after the jump. Here’s the github project for my AoI clojure plugin.