Inkscape to OpenSCAD converter v7

Inkscape to OpenSCAD converter v7

thingiverse

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 Notes 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() { translate(path4807_0_points[t]) 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. E.g. // 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.

Download Model from thingiverse

With this file you will be able to print Inkscape to OpenSCAD converter v7 with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on Inkscape to OpenSCAD converter v7.