MadArtBot: Turning Shapes Into Things
So, have you designed any 3D objects yet? No? What, you say you can’t? Liar! If you can draw shapes, you can make a 3D model. Today, we’re going to walk you through a couple easy ways to make a 3D model from a drawing. Ready?
OK, first, you’re going to need to install a couple apps: Inkscape and OpenSCAD. Nice thing about these is a) they’re free and b) they’re available on Windows, Mac and Linux. So you have no excuse, right?
Got them installed? Great. Now let’s draw a couple pictures. You can do this in any paint app. I’m using GIMP (again, free and multi-platform). Make them 400×400 pixels and save them as opener.png and glass.png. JPG would probably work too but PNG seems to give me cleaner edges. Save them in some convenient place. I’m putting mine in a folder called extrude_demo. They don’t have to look exactly like these but something close would be good. Just as long as they’re black shapes on a white background. Or, y’know, you could just cheat and use these…
Now, open Inkscape.
1. File -> Import
Let’s import opener.png first. It’ll ask if you want to link or embed. Pick embed.
2. Position the picture centered on the lower left corner of the page.
This will translate to an object centered on the build platform.
3. Path -> Trace Bitmap
When the dialog comes up, just hit OK and close the dialog. The defaults are fine. This creates an outline of the drawing you made.
4. Click on the Edit Paths By Nodes thing, then Edit -> Select All.
This selects all the nodes in the outline.
5. There’s now an icon in the upper left that’s a node with a plus sign (Insert new nodes into selected segments). Click this a couple times. This breaks up the segments into smaller pieces, which will make importing them easier.
6. Click the icon that’s a diagonal line with 2 nodes (Make selected segments lines). OpenSCAD doesn’t like importing curves.
7. File -> Save As
Save it as a Desktop Cutting Plotter (*.dxf) Call it opener.dxf and, when asked, use LWPOLYLINE. Save it in the same location as your PNG.
Once you’ve saved glass.dxf, you can close Inkscape. If it warns about saving the documents, select “Close Without Saving”.
OK, now open OpenSCAD and enter the following code.
linear_extrude( height =15)
What’s happening here is we’re loading the opener drawing, scaling it down a bit and then extruding it up through a third dimension to get a 3D object.
Save this as opener.scad in the same location as the other files.
Now do Design -> Compile.
Woo! Look at that! It’s a …thing! You can drag the mouse around the preview window to spin it around a bit.
To get that into an STL file that can be printed, do Design -> Compile and Render, then Design -> export as STL. That’s it! Honest!
Cool, but what’s that “glass” thingy all about? Well, for that, we’re going to do a different kind of extrusion where you sweep the shape around in a circle. This time, enter the following code and save it as glass.scad.
…and compile that. (Note: This model might not be practical for printing on an open-source printer. It’s a bit spindly.)
Cool, huh? So, the rotate_extrude takes the drawing as a profile view and sweeps it around the Z axis. That $fn thing specifies the number of segments in the sweep. Change the 200 to a 6 and compile again, and you’ll get a weird sort of hexagon thing.
That’s it. That’s all there is to it. If you can draw a shape you can make an (admittedly simple) object. Now you have no excuse. Go make some stuff!