Recently there was a challenge posted to the MakerBot Operators list to come up with a way to create 3D logos. Some people discussed ways of taking an image and automatically turning it into a 3D design. So I decided to take a break from Mendel production and started looking around for a way to do just that. I found a cool utility called autotrace that can take a bitmap and convert it into a vector graphic format including DXF. I thought cool, I could use the output and feed it into OpenSCAD which can extrude 2D DXF drawings into 3D shapes. I could even automate it all on the command line by generating an image using ImageMagick and any true type font like so:
convert -size 400x400 -background transparent -fill black -stroke black -gravity center -kerning -30 -font Helvetica-Bold caption:'Tony Buser' foo.png
autotrace --output-file=foo.dxf foo.png
/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -m make -s foo.stl foo.scad
Unfortunately, that didn't work out...

You see, OpenSCAD doesn't support just any old DXF file. It only supports very simple DXF files and unfortunately the output from autotrace isn't simple enough. So I could either add support to OpenSCAD for POLYLINE or change autotrace to output a different flavor of DXF. I'm not really prepared to tackle either option... then someone
mentioned making a set of simple block fonts in DXF that we could import into OpenSCAD. That gave me the idea to try and implement a bitmap font system in OpenSCAD code itself.

I had never really used OpenSCAD much, but once I got over the limitations (like no string handling, inability to like ya know properly set the value of a variable, ugh) I came up with a pretty good bitmap module. It works by passing an array of 1's and 0's and it generates cubes of a specific width and height in a grid pattern and then combines them into a single shape. Then I went looking for a set of 8bit fonts and settled on the good old
Atari font. I probably should have wrote a program to generate the arrays from the image data... but I ended up encoding each character by hand. I actually found it kind of relaxing to do while my MakerBot buzzed and whirred in the background. Also kind of reminded me of making ascii art back in the BBS days. Another cool thing is that I made it easy for anyone to create their own bitmap arrays and the arrays can be of any dimension. The 8bit fonts are 8x8 matrixes, but you could make smoother fonts if you want at 16x16 or 64x64 cube "pixels". (although bitmaps that large might make OpenSCAD choke, but theoretically there's no limit) Someone even suggested a braille font set which would be really cool.
I have some ideas I'd like to work on such as:
- a personalized parametric clip-on name tag for your MakerBot (clip onto the edge of the body of your bot)
- "height maps" Instead of just 1's and 0's each bit in the array you could specify the height of the cube pixel. Could also then write a script to convert a grayscale image into an array, like a terrain height map
- a web service where you can type a message and have it spit out an STL file for you to print, maybe a web based bitmap editor
But for now, I'm going back to printing RepRap Mendel parts...
Comments [1]