ActivitiesCraftingDrawingGeekeryMagic

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…

opener.png

glass.png


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.

Create a new document and do the same thing again with glass.png. This time, though, put the picture centered on the left side but sitting on the bottom.

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)
scale(0.4)
import_dxf(file="opener.dxf");

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!

Hey, wanna see something freaky? Change that first line to
linear_extrude( height =15, twist=30, slices=10)

That twist thing will let you make spiral forms from simple shapes. Here’s one I made from an elipse:

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.
rotate_extrude($fn=200)
scale(0.4)
import_dxf(file="glass.dxf");

…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!

Previous post

Gays in the Military (and In Your Speakers)

Next post

Artless & Broken: My Brother and Ows

Steve D

Steve D

Steve consists of approximately 60% water and 40% organic molecules, arranged in a configuration that is, among over things, capable of describing itself in this manner.

4 Comments

  1. December 21, 2011 at 7:37 am

    I think my comment here got eaten by the great “ladybits” crash of 2012.

    I’m assuming that there’s a way to combine?, layer?, stack?, glue? simple shapes together. The idea that’s tickling my brain could be made if shapes like the bottle opener could be grafted onto a curve like the side of the glass.

    I was also wondering how long it takes to print things? That opener for example.

  2. December 21, 2011 at 8:18 am

    Yep! Most modeling apps have a set of binary functions for combining two shapes. Something like: union, intersection and difference. There’s an example of this using simple shapes on a previous post (http://madartlab.com/2011/12/08/3d-things/) but you can do the same with any two shapes, no matter how complex. And you can nest the functions to do stuff like A unioned with B intersected with C. It’s really easy to build up complex objects this way. It’s also easy to get carried away and end up with a complete mess. 😀

    Something the size of a bottle opener would take about 10 minutes to print on my printer. It depends a lot on feed rate and resolution but the rule of thumb is the print time increases with total volume. I’ve seen people do prints that took hours to complete.

  3. December 23, 2011 at 6:05 am

    Doh! I read that post, I’m going to blame the season and the fact that I work in retail for that memory lapse. Thanks for that anyway Steve.

    I’m trying to figure out if buying one of these things is going to make financial sense for my business. One of the things we do is put a sticker on every bike we sell saying “Sold and serviced by…..” in the hopes that the customer won’t peel it off and someone who likes the look of their bike will see it. I’ve been thinking that if I printed 3D versions of that with some kind of fun logo they’d be much more likely to be left on the bike.

    I can also see the occasional use of it to make shims and such to get parts to play nice together. I’m often stacking washers and grinding their edges off to get things to fit. If I could design and print something in less time it’d be a great help. I suspect though that my lack of design knowledge would make that aspect of the process take longer than my current procedure. Mind you, I can see having a set of stock shapes that would only need tweeking for specific functions, hmmmmm.

    Of course, the fact that I could also make stupid and/or strange shit just because has no bearing whatsoever on my lust for this tech. Nope sirreee, no desperate rationalisation going on here…..

  4. December 23, 2011 at 10:44 am

    What I’d suggest is try designing a couple things and sending them off to some place like Ponoko or Shapeways. For large quantities, your best bet might be to get one really high quality print done and make a silicone mold from that.

    That is, unless you really just want an excuse to get your own printer, in which case, yeah, you totally totally need one. 🙂

Leave a reply