Inkscape to OpenSCAD converter v7

by Neon22, published

Inkscape to OpenSCAD converter v7 by Neon22 Oct 11, 2015

Thing Info

1268Views 599Downloads Found in 3D Printing
Report Thing


A series of mods to Dan Newman's excellent paths2openscad program.
These include:

  • separating the paths themselves into variables so they can be used in other ways.
  • adding helper functions to enable them to be rescaled easily.
  • automatically saving unclosed lines as lines and not as joined up closed curves.
  • adding an option to save any closed curve as a line if desired.

For Inkscape 0.91 and above


Once you run the program. You'll get a .scad program with three main sections in it.

The first has the global variables. You can edit these directly to change the height and width of the resulting openSCAD file. There are also helper function sin there if you want to rescale the shapes to fit a desired size in openSCAD instead of relying on their apparent size (in mm) in Inkscape. (see at end).

profile_scale = 25.4/90; //made in inkscape in mm

// helper functions to determine the X,Y dimensions of the profiles
function min_x(shape_points) = min([ for (x = shape_points) min(x[0])]);
function max_x(shape_points) = max([ for (x = shape_points) max(x[0])]);
function min_y(shape_points) = min([ for (x = shape_points) min(x[1])]);
function max_y(shape_points) = max([ for (x = shape_points) max(x[1])]);

height = 5;
width = 0.20000000298;

Next will be a group of line definitions. These are named after the internal inkscape name for the thing. These may be well named or not - depends on how they were made.
Probably a whole pile of these. Here is one.

path4807_0_points = [[-5.845255,2.425518],[-3.310449,-0.509821],[-1.975026,-1.552367],[-0.578824,-2.215045],[0.889731,-2.425518],[2.442214,-2.111448],[4.090197,-1.200495],[5.845255,0.379678]];

module poly_path4807(h, w, res=4)  {
  scale([profile_scale, -profile_scale, 1])
  union()  {
    for (t = [0: len(path4807_0_points)-2]) {
      hull() {
          cylinder(h=h, r=w/2, $fn=res);
        translate(path4807_0_points[t + 1]) 
          cylinder(h=h, r=w/2, $fn=res);

Some will have NNNN_paths as well as NNNN_points variables. These are for more complex nested shapes like (say) the capital letter B.

Finally at the end will be a block where each of the shapes defined above is called, evaluated and turned into an object.

// The shapes
poly_XDiv2(height, width);
poly_YDiv2(height, width);
poly_YDiv1(height, width);
poly_rect4809(height, width);
poly_YDiv3(height, width);
poly_path4702(height, width);
poly_path4736(height, width);

You can comment some of these lines out if you want to isolate some shapes.

Finally there are 4 helper functions which have been added in the first section. If you want to rescale the shapes to be a different scale you can use them to find the min and max, X or Y values, of the shape and rescale to a new size.
To do that you might create a line like this:

// Calculate the proper scale for an arbitrary drawn curve,
//  so that its profile height = wanted_height.
// where shape is the NNN_points variable.
new_scale = wanted_height / (max_y(shape) - min_y(shape));

Then do a scale(new_scale) {...} in openSCAD above the polygon. This will scale it to be wanted_height in Y.

More from 3D Printing

view more

Thing Info

1268Views 599Downloads Found in 3D Printing
Report Thing

A part of these Groups

View All

Liked By

View All

Design Tools

Inkscape OpenSCAD


Inkscape to OpenSCAD converter v7 by Neon22 is licensed under the GNU - GPL license.

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag. Print Thing Tag

All Apps

No results.

Apr 6, 2016 - Modified Apr 6, 2016

I am trying to use this app and whenever I push apply it says ""Paths to OpenSCAD" is working, please wait..." and then nothing else happens. How to I get my image to appear in OpenSCAD?



Apr 6, 2016 - Modified May 30, 2016
Neon22 - in reply to InTimmydator

The extension should generate a file as shown in the UI - It is called profile.scad and its in your home directory by default.
Look for this file. Open it in openSCAD - Simple Double L click should work.

If the program does not seem to be doing anything then check:

  • if you have nothing selected then everything will be converted.
  • if you have a shape selected then only that shape will be converted (or group of shapes).
  • Try a small object first if you think maybe your real object is too big or complex and its taking forever.
    Let me know if this works.

Couldn't get V6 to work for me, but this version worked perfectly.

Windows 7
Inkscape 0.91
OpenSCAD Version 2015.03-2