Programming, SDXF Documentation

Python library for generating DXF files

I’ve gotten a little frustrated with the limitations of using Processing to generate PDFs for laser cutting. Primarily, there’s no support for “hairline” thickness lines, which add an extra step to getting things ready to lase, and there’s no way to separate lines into different layers so it can be hard to work with the file later if you want to raster etch some lines and vector cut others.

Adam suggested looking into a DXF library someone had written for Python. Indeed, there is a very nice library. Unfortunately the original documentation for it seems to have gone missing.

I’ve started documenting the library, it’s called SDXF and is pretty thorough. I don’t know Python, or DXF, but so I’m picking up both as I go along.


Woolly Tiny

Not wanting to get Tinysaur to get all the spotlight, I bring you… WOOLLY TINY. Like a Woolly Mammoth. But Tiny.

The pattern comes from the epilog website and the assembly was done with a pair of tweezers and a baby syringe full of Elmer’s glue.

If you’ve always wanted your own mini mammoth, or just want to show off you have the steadiest hands of anyone ever, you can pick up the pre-lased parts on Etsy.



Hm it’s been a while since I’ve posted, been busy with a lot of boring, non-hacking stuff. Travesty! But here’s something vaguely interesting:

Often when I’m writing a bunch of PHP I want to be able to see the MySQL queries its generating. Usually I just comment out the mysql_query() and replace it with an echo. But sometimes that’s annoying, or I want to check multiple queries at once and don’t feel like switching them back and forth all the time.

I wrote a quick function called mysql_awesome_query(), which will either execute or echo a query depending on whether it’s a SELECT, INSERT, UPDATE, or DELETE/DROP.

//1 is run, 0 is echo sql
$flags = array(

function mysql_awesome_query($sql){
$flags = $GLOBALS['flags'];

$result = mysql_query($sql);
return mysql_error();
} else {
return $result;
} else {
echo $sql;
return false;

The $flags global variable is an array of settings for which types of queries to execute, based on the first letter of the query string. MySQL conveniently doesn't have a lot of overlap there.
When mysql_awesome_query() is executed it checks the first letter of the query and if the corresponding array value is 1, it executes it and returns either a result or a mysql error. If it's 0, it simply echos the query so you can review it.

I'm sure there are more elegant ways to do this, but this was quick and dirty and works for my purposes.


Folded paper boxes

I’ve been working on learning Processing, a language which is a bastardization of Java used for drawing pretty pictures (among other things). Most of its functions are based around drawing/graphics.

Processing project #1 was to generate templates to be cut on the laser cutter. Specifically paper boxes, because I needed something to package my Tinysaurs in. They end up looking like this:

Laser-cut boxes

You enter the depth, width, and height of the box, and Processing draws the pattern

Processing has a PDF library which I use to generate the template in PDF format, which Corel Draw is able to read. I’m looking into using Python instead of Processing, because it apparently has a nice DXF library. Although the fact that Adam scoffs at Processing makes me want to keep using it just to annoy him.

The Processing program is available in the NYC Resistor SVN repository. Which is public, hooray! The code is only vaguely commented, but it should be pretty clear what it’s doing. Maybe.

Of course you dont’ need a laser to cut these out, and xacto knife would work just fine. But… I have a laser so I use it.

If you don’t want to mess with Processing and just want to print box patterns, you can do that too. I’ve generated a bunch of sizes:

You may need to right-click and save the pdf to your hard drive to get it to load.

lased, Networked USB Lamp

New Project: Lamps

Hooray, a new project!

At work it often gets very loud in my office, so everyone wears headphones. Unfortunately this makes it difficult to get someone’s attention, because they’re all rocking out to David Bowie or whatever. Also, it gets very dark in my office because we don’t have desk lamps.

The solution, clearly, is networked USB lamps that you can make blink if you want to get someone’s attention. Someone else suggested a cheaper solution would be Nerf balls to throw at each other, but that’s way less fun to build.

Lamp prototype

Here’s my prototype for part of the first lamp. I’m making 5 lamps total, and they’ll all be different. Each lamp will have white LEDs for general lighting, and then different colored LEDs for various alert functions. The first couple will probably just use normal, colored LEDs. I’ll try some RGB LEDs later, they’re just so stupidly expensive compared to normal LEDs.

I wrote a program in Processing to generate the parts, so I can easily make models of different sizes or with different thickness materials. I’ll post it in a bit when things are a little farther along.

I’m using an Arduino to prototype the electronics, but will probably switch to something cheaper like an ATTiny when I go to build the lamps.

Just because it’s handy, I’ve written the prototype drivers for the lamp in Processing, but that’s only because I already had it open. Eventually I’ll want something that can hang out in the systray / menu bar, and I don’t think Processing allows for that. Tho one advantage of Processing its an easy way to make executables for both Mac and Windows. Or it pretends to be, I’ve had inconsistent luck getting Processing applications to run on my windows machine. Thanks, Java!


Lasering Rocks

In case you were wondering “Can you laser etch rocks?”

Lasering Rocks

You totally can.
Robo-rock was etched in raster mode at 20% speed and 100% power on a 35 watt laser.
Unlike the last robo-pet I had (grass) this one should be substantially harder to kill.

Related ideas we’ve come up with include etching a bunch with electrical symbols and casting them like runes for circuits. Of course this led to a discussion on casting bones, and then etching them.


So. Much. Laser.

Today I made EVEN MORE STUFF on the laser cutter. AND, this time I actually listed something for sale on Etsy. This is the first time in many, many months I have actually listed things for sale (excluding mindlessly hitting renew when things expire). It’s awesome to actually make things I like again.

I made the city ring in blue acrylic:

I also made it in white acrylic but there was a small problem. The white was slightly warped. This caused the laser to be out of focus when it hit it, making things generally melty.

Tri-city area

Within an hour of listing the blue ring on Etsy, I’d sold 2. So I guess they’re a hit? I also made one out of day-glo pink plastic. It’s a little blinding.


Laser Rings


I tried to make a tiny city on a ring. It came out OK but I’m still figuring out what scale works with what materials. Also, balsa is useless; never use it for anything.

I have been using a program called QCAD to draw out the designs, and its been kinda frustrating. The documentation for it is terrible. Bre found a guy who does tutorials which has helped a little, but its overall a slow process. In some ways its similar to Rhino, which I learned in college, but the UI is totally different and its annoying. I’m debating whether to reinstall XP on my laptop (it has Ubuntu right now) just so I can use Illustrator instead. Because apparently I have forgotten how much I hate Illustrator.

I also made another ring, but the basswood was too weak for the design, and the notches were a tiny bit too small.