Instructables
Picture of Make a 3D print from a 2D drawing
DSC_6859.JPG
Using a few open source software tools and very little technical knowledge, it's possible to turn a 2D vector drawing into an extruded object for 3D printing.  I used this technique to make a bracelet.

Overview:
  1. Make an .svg file of the shape you want to extrude
  2. Convert it to OpenSCAD format using an Inkscape extension
  3. Use OpenSCAD to render and generate an .stl file
  4. Print the object
 
Remove these adsRemove these ads by Signing Up

Step 1: Make an .svg file of the shape you want to extrude

First get a shape that you want to extrude.  It needs to be in a vector graphics format, not bitmap (or raster) format.  Read up if you're not familiar with these terms.

To get a vector graphic you have three options:
  1. Download it.  You could use Google Advanced Image Search and limit your search to .svg files, a common vector graphics format on the web.  You want to make sure you have permission before you use anyone else's drawings, though.
  2. Draw it yourself. Use Inkscape, Illustrator, CorelDRAW, or any of the many other vector graphics applications.  Drawing vector graphics is its own topic worthy of many instructables.
  3. Make a digital trace. If you do have a raster image (bitmap), then you can convert it to a vector graphic with Illustrator's live trace or Inkscape's trace features, which are fun to play with.  Keep in mind that these features are not magic, and you'll have to fiddle around a lot to get the graphic right.
Then save the file as .svg format.

Step 2: Convert the .svg to OpenSCAD format

Picture of Convert the .svg to OpenSCAD format
OpenSCAD is the software that will extrude the object for us.  However, we first need to convert the .svg to OpenSCAD format in Inkscape using the magic of this Thing.

Do this:
Install Inkscape.
Download the paths2openscad script at GitHub.
Move the script to your ~/.config/inkscape/extensions folder.
Open Inkscape.
File -> Open to open the .svg file.
Extensions -> Generate from Path -> Paths to OpenSCAD to generate the .scad file.
Save the file with the extension ".scad"

Now you're ready to render.
 

Great instructions, thanks! But what about going in reverse? I want to make a 2D drawing from OpenSCAD.
At least, that is the route I am taking to make a user input parameter 2D drawing. Any ideas?

safay (author)  alexmadinger26 days ago
Thanks for your comment, Alex.

Can you explain a bit more about what you're trying to do?

Without being totally sure about your goals, I would suggest trying out either processing or d3.js instead of trying to go from OpenSCAD to 2D.  Both are well supported and have rich documentation and tutorials.  Processing is probably easier to learn if you don't have programming experience, though D3 is better if you want totally flexible web integration.  D3 has a steeper learning curve unless you've done web development in the past.  I'm just trying to learn D3 right now myself for data visualization.  I'm pretty sure it can make an svg from user-provided parameters.

omarrola1 month ago

I can't find this folder ~/.config/inkscape/extensions on my mac .

How do I find it?

safay (author)  omarrola1 month ago

Without looking in your system myself it's hard to tell. Can you do a search for inkscape extensions? Try /usr/share/inkscape?

Open terminal and type:

find . -name inkscape

IDK. If you have Inkscape installed, it should be there somewhere.

omarrola safay1 month ago

while trying to install/open OpenSCAD on my MAC i get :

“OpenSCAD” can’t be opened because it is from an unidentified developer.

safay (author)  omarrola1 month ago
Foxtrot704 months ago

Safay - I was wondering would this work with a photo. In stereo viewing a regular print can be viewed in 3D by offsetting a copy of the original thus fooling your brain that its 3D. Could the same be done by merging the two offset pics in the CAD converter?

I was curious about how to do this, thank you.