Editorial note: I didn't actually write a musical about modularization. I just liked the title, and have a theory that Melissa Schmitz only reads my blog if there's alliteration involved. Sorry for misleading you.

I combined a few projects today to make a gift for someone, as well as some potential prizes for people when we launch our Film Tycoons Kickstarter campaign. I've been 3D printing personalized dice for a long time and shared earlier the custom pawns I made for the game -- yesterday I built a box specifically for these types of toys.

But not just any box! It's a modularized box! Or rather, the OpenSCAD code to generate the box is modularized. The point: efficiency of flexibility. The OpenSCAD script results in one command for each of the box parts: the bottom, the lid, the part-specific insert, and the name plate. You can produce many configurations of the box with hardly any time required, no cloning, re-modeling, etc.

Eric Hallberg, if you're reading this, feel free to borrow the technique for the automobile industry. Seriously, no charge. Happy to share. :)

The lid changes size simply by changing a variable. The dice fit in the box with the default lid size, so rendering the lid is as easy as typing boxlid(). The Film Tycoons pawns are taller, though, so boxlid(14); makes a taller lid to accommodate. Likewise, the nameplate is a separate piece which fits somewhat snugly (and even more so with a little epoxy) to the lid; I could have printed the name directly in the lid, but the separate plate allows for a lot more flexibility.

The round or square inserts -- similar approach. Specify the size of the holes in the insert and the code centers them appropriately. Most important here is that by printing the insert separately the box bottom can be printed ahead of time. (I didn't take the extra step of combining the round-hole and square hole inserts in a single code block, but I'll likely do that before blogging about the actual code.)

Odd "box" trivia: the Simon & Garfunkel song The Boxer is NOT about a dog after all!

Oh, and the length and width of the box? Also variable-driven. If I needed ten dice for that Super Secret Professional Double Yahtzee League, it's just a matter of tweaking two numbers and you suddenly have a ten-die box.

The only part of the project that can't be tweaked and re-printed in seconds* is the Chinese writing. That's a bigger challenge than putting text on the nameplate; the characters have to be brought into another program as a graphic, converted to a format OpenSCAD can understand and extrude as a 3D object, then incorporated into the model. Another topic for a later blog.

And Missy, I still feel slightly guilty about the alliteration/musical thing, but I'll try to make it up to you. Maybe with some 3D printing haiku or something. You're welcome in advance.

* That's not exactly true. Nothing 3D prints in "seconds." At least, not in so few seconds that it wouldn't be more appropriate to measure in minutes or hours. The more accurate way to say this would be, "...tweaked and started re-printing in seconds."