This is an Inkscape extension that allows you to save your Inkscape drawings as OpenSCAD (.scad) files containing modules with 2D polygons suitable for extruding into 3D shapes.
Author: Marty McGuire
Website: http://github.com/martymcguire/inkscape-openscad-poly
- This is a port of my MakerBot Unicorn G-Code Output extension.
- Inkscape is an awesome open source vector graphics app.
- OpenSCAD is an awesome open source language for creating 3D objects.
- Scribbles is the original DXF-to-Unicorn Python script.
- The Egg-Bot Driver for Inkscape provided inspiration and good examples for working with Inkscape's extensions API.
Copy the contents of src/
to your Inkscape extensions/
folder.
Typical locations include:
- OS X -
/Applications/Inkscape.app/Contents/Resources/extensions
- Linux -
/usr/share/inkscape/extensions
- Windows -
C:\Program Files\Inkscape\share\extensions
- Size and locate your image appropriately:
- Setting units to mm in Inkscape makes it easy to size your drawing.
- The extension will automatically attempt to center everything.
- Convert all text to paths:
- Select all text objects.
- Choose Path | Object to Path.
- Save as OpenSCAD:
- File | Save a Copy.
- Select OpenSCAD Polygons (*.scad).
- Save your file.
You'll find each path from your Inkscape file appears as a module
in the
resulting OpenSCAD file.
For example:
// my_drawing.scad
module badge_face() {
polygon(points=
[[-16.704628355490897, -20.69348168358303], [-13.479257330090903, -35.207652708983034], [-2.1904573300909078, -23.918852708983053], [17.161771644509102, -71.493081683583029], [-11.866570406290904, -40.045710658183026], [-13.479257330090903, -63.429652708983014], [-36.056857330090907, -56.172565785182996], [-30.412457330090902, -2.9539396327830048], [-0.57777040629089527, -1.3412527089830064], [16.355429593709104, -20.693481683583002], [38.126687542909096, -57.785252708983023]]
, paths=
[[0, 1, 2, 0], [3, 4, 5, 6, 7, 8, 9, 10, 3]]
);}
You can include this file in your OpenSCAD program and use OpenSCAD's 2D-to-3D extrusion methods, calling these modules to get the 2D data!
// my_object.scad
include <a_badge.scad>;
linear_extrude(height=20)
badge_face();
- Use square and circle where applicable for simplicity?
- Combine layer contents into single modules?
- Apply fill colors to the polygon defs.
- Parameterize smoothness for curve approximation.
- Include example files/templates.