I want to be a Borg.
Okay, not really. But ever since I saw them in Star Trek: The Next Generation as a kid, I thought they were the coolest villains on the show. From the “We are the Borg” opening speech, to their organism/machine fusion appearance, they were the episodes I loved to watch over and over. And one of the things that stuck out to me was their ships. Giant cubes assembled for (presumably) maximum functionality, able to strike fear into any Federation officer’s heart.
Seriously, how cool is that? So, since I’m learning Python, and I just “finished”* my own home-built 3D printer, I thought I’d try and write some code to generate random Borg cubes for me to 3D print. To keep it simpler, I decided to take a kitbashing sort of approach; I would predefine some structures in OpenSCAD, and let Python select and place them at random for me on a panel. Then all I’d have to do is generate 6 panels, print them, assemble them and I’d have my own Borg cube! Easy, right?
The hardest part was making sure that the end result was even marginally printable; when you’re relying on code to just throw things down (especially if you haven’t ever tried any kind of procedural generation), there’s a good chance you’re going to get pieces which hang over empty space, don’t connect to the main body or just don’t fit into the predefined space you want them in. But I kept tweaking, and now everything gets placed within the right area, and I don’t have anything trying to print in midair. That said, the code could still use some work.
So, that’s where I’m asking for help. I’ve put my code on Github, and if anyone out there wants to improve it, I’d appreciate guidance. Or, if you just want to try and print your own fleet (each panel is about 2 hours, down from 5 when I started), go for it. Just be sure and share the results with us on Facebook or Twitter!
*I say “finished”, because a 3D printer is never done. You just learn to work around the loose wiring.