Skip to content

Inkscape extension for exporting drawings as OpenSCAD modules of polygon() calls.

License

Notifications You must be signed in to change notification settings

Davorak/inkscape-openscad-poly

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

OpenSCAD Polygon Output for Inkscape

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

Credits

Install

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

Usage

  • 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.

Use in OpenSCAD

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();

TODOs

  • 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.

About

Inkscape extension for exporting drawings as OpenSCAD modules of polygon() calls.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%