Inkscape to OpenSCAD converter v6

by dnewman, published

Inkscape to OpenSCAD converter v6 by dnewman Jun 15, 2012
3 Share
Download All Files

Thing Apps Enabled

Order This Printed View All Apps



Inkscape to OpenSCAD converter v6 by dnewman is licensed under the GNU - GPL license.

Use This Project

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


Thing Statistics

76025Views 23404Downloads Found in Tools


UPDATE: added version 6 of Thing #24808
This is version 6 of Thing #24808
Libre Graphics World has a nice write up by Alexandre Prokoudine of this extension at http://libregraphicsworld.org/blog/entry/inkscape-gets-openscad-converter
This Thing is an Inkscape extension to export Inkscape paths to OpenSCAD. There has been at least one prior Thing attempting this, Thing #9376. However, it only handled a small subset of SVG. This extension handles SVG arcs, clones, circles, ellipses, groups, lines, paths, polygons, polylines, rects, and splines. It also follows document transforms as well as viewports. Either an entire document or just the selected portions of a document are processed.
SVG text must first be converted to a path within Inkscape using Inkscape's "Path > Object to Path" menu item.
Note that another approach to importing SVG into OpenSCAD is to save the SVG to DXF from within Inkscape. Then use OpenSCAD's import() function to import the DXF. [Older versions of OpenSCAD used import_dxf().]
Much of the core code in this extension is derived from work done by myself and others while developing the Inkscape driver for the Eggbot.
15 June 2012: Added support for a single level of polygon nesting. I.e., subtract from a polygon the polygons contained within it AND from the same Inkscape path. This works well for most fonts. You can tell Inkscape to combine multiple polygons into a single path by selecting the polygons and then using "Path > Combine". (You do not need to do this for text converted to a path: Inkscape already does the proper combining.)
15 June 2012: Corrected Windows issue with handling of Unix-style file paths.
21 June 2012: Correct a typo in the extension. Would not affect content generated by Inkscape but might have affected SVG content generated elsewhere and loaded into Inkscape.
9 May 2013: Modified the code to remove non alphanumeric characters from the strings used to generate the OpenSCAD module names. Some SVG paths had non alphanumeric characters in their path ids and those ids were being used to generate OpenSCAD module names. OpenSCAD doesn't allow that.
29 May 2013: Corrected an issue whereby the converted could exit with an error when attempting to warn about images embedded in the SVG file or Inkscape drawing. Images are not allowed and the converter cannot convert them. However, it should gracefully warn about the issue and exit normally.
30 May 2013: Fixed a bug in the v4 version.
16 Aug 2013: Possible workaround to Inkscape bug experienced by some users, "terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct null not valid"


MAC 10.7 or later users, see the second note in the Notes section! This means Lion, Mt. Lion, and beyond.
Download the paths2openscad-2.zip file from this page. After unzipping that archive, you should have two files: paths2openscad.py and paths2openscad.inx .
Once you have downloaded paths2openscad.zip, open the zip file and place its contents in your local Inkscape extension folder,
on Linux and OS X. On Windows systems, you can place them directly into the Inkscape extension directory. For example, if Inkscape is installed in C:/Program Files/Inkscape then the extension directory will be C:/Program Files/Inkscape/share/extensions.
Once you have placed the two files in the proper directory, exit and then restart Inkscape. The extension should appear under the "Extensions > Generate from Path" menu as "Paths to OpenSCAD".
To use the extension,

  1. You may find it helpful to set your document units to millimeters and the document dimension to millimeters as well as a reasonable document size (e.g., 100 x 100 mm). Do this with the "File > Document Properties" menu item. The document units is in the upper part of the dialog box while the document dimensions are near the bottom of that same box.
  2. To see what the extension sees, set Inkscape's display mode to "outline". This is done with the "Display Mode" item of the "View" menu.
  3. Next ensure that within Inkscape, the desired objects have been converted to paths. Use the "Path > Object to Path" menu item to convert objects such as text to paths.
  4. Select the desired objects to generate an OpenSCAD program for. If you wish to generate a program for the entire document, then select nothing (i.e., "Edit > Deselect").
  5. From the "Extensions" menu, select "Generate from Path > Paths to OpenSCAD".
  6. In the dialog window which appears, enter the name of the output file to generate. (Windows users: the "~" notation indicates that the file goes into your "Document and Settings" folder.) You can also enter a extrusion height and a smoothing parameter. For most purposes, a smoothing parameter of 0.2 is sufficient. If your paths have lots of tight, twisty curves which are described using arcs, circles, ellipses, or other SVG elements which aren't collections of straight line segments, then you may want to use a smaller value.
  7. Click the "Apply" button. A pop-up window will appear while the extension is running and will then disappear when it is done running. After the extension is done running, you can click the "Close" button to dismiss the extension's dialog window. If an error occurs, you will see an error window appear when the extension is running.
  8. From OpenSCAD, open the output file you generated with the extension and render it.
    If you wish to build solids involving subtracting one polygon from another, be sure to combine the two polygons into a single path: select the polygons and then combine them with "Path > Combine". Only a single level of nesting is handled at present. You do not need to do this for text converted to a path: Inkscape already does the proper combining.
    I have seen a few complex, but legitimate polygons, compile and render with F5 but not with F6 in OpenSCAD. They instead trigger some internal error detection code in OpenSCAD.
  9. The sample .svg, .stl, and .scad files serve as examples: you do not need to download them to use this Inkscape extension. You only need the .zip file.
  10. OS X Lion (10.7) and Mt. Lion (10.8) users need a "patch" to allow Inkscape extensions to work correctly. This is a general Inkscape issue and not specific to this extension. At issue is the lack of a Python package, lxml, which Inkscape extensions use to read (parse) SVG files. Install the patch from https://code.google.com/p/eggbotcode/downloads/detail?name=EggBot2.3.1.r4s.zip . This will also give you Eggbot extensions, many of which I wrote. (An Eggbot is a cool pen plotter for plotting on Eggs.)

More from Tools

view more

All Apps

3D Print your file with 3D Hubs, the world’s largest online marketplace for 3D printing services.

App Info Launch App

This App connects Thingiverse with Makeprintable, a cloud-based mesh repair service that analyzes, validates and repairs most common mesh errors that can occur when preparing a 3D design file for p...

App Info Launch App

Kiri:Moto is an integrated cloud-based slicer and tool-path generator for 3D Printing, CAM / CNC and Laser cutting. *** 3D printing mode provides model slicing and GCode output using built-in...

App Info Launch App
KiriMoto Thing App

With 3D Slash, you can edit 3d models like a stonecutter. A unique interface: as fun as a building game! The perfect tool for non-designers and children to create in 3D.

App Info Launch App

Thanks for the great thing! Worked like a charm.

I had one minor issue which was my own fault. The description mentions "Use the Path > Object to Path menu item to convert objects such as text to paths", however I actually had to use "Path > Stroke to Path" since I had some designs that were strokes (SVG design provided by someone else). I identified the issue by changing the display mode to "Outline", as recommended in the description.

Mar 5, 2016 - Modified Mar 5, 2016

hi dnewman, it's me again. i had problems with " cannot open file : C:\programs files\xxx when i use the " path to openscad" at the extension.

thanks in advance for your help. it's getting nowhere to fun now.

Sorry, I'm not a Windows user. I really have no idea what you might be doing wrong.

Hi there,

I really like your extension, helped me a alot, many thanks!

While using, however, I noticed some improvement potentials - maybe you can check this out:

  • sometimes the path names get some dashes in between which cause OpenSCAD to bring up an error (poly_path5659-1-4, e.g.). After manually removing the dashes, everthing works, maybe the extension could do this automatically?
  • there is a scale statement in each path, is that necessary? Because if I have a large number of paths and I want to change the overall size of the drawing, is it a little bit tidious and the search/replace function is very dangerous...

Cheers, Baldur

Thank you so much for that extension!

Hm, made a svg with a round object with the size x 244 x 244, but when open the scad from inkscape in openscad, it seems to be much smaller. Any idea what I might be doing wrong? Btw: Thanks for a great script!

Whatever tool you used to create the SVG file either didn't specify in the SVG the units/dimensions or did so using a non-standard means. When the dimensions cannot be determined the default SVG units and dimensions are used.

I used the latest inscape for windows and v6 og this extension. Mm as unit.

Inkscape to OpenSCAD converter v7
by Neon22

It seems to export an OpenSCAD file for me, but in OpenSCAD it always just shows the outer part of the picture/path. Say I have a snowman ornament originally meant for scroll saw work - it has an outer circle shape, and then lines to follow and cut out on the inside. I want to generate a 3D model that is empty inside some lines, and extrude the rest 10-15mm (essentially having the same end result as scroll saw work, except in plastic instead of wood). All that seems to make it to OpenSCAD though is the circle outline - and nothing inside that circle gets rendered.


www.selva3d.com does this automatically.
It's supereasy and free :)

The converter at www.selva3d.com is in beta state. It does not work :-(

But the actual Inkscape to OpenSCAD converter v6 DOES. Nice job!

Sorry, but I'd rather have something local and offline that doesn't output ugly vertical edges :)

Comments deleted.

Thank you!
This still works in Inkscape 0.91!

I am new to 3D Printing and am working on a MAC. Where do I place the extension files after I unzip the file? Any help is appreciated.


This might be off topic, but I haven't found an answer elsewhere. When I switch my display mode to outline, my image disappears and I get a red box with an X in it. I'm sure this has to do more with my lack of understanding of vector graphics, but can anyone point my in the right directions.

Mar 25, 2015 - Modified Mar 25, 2015
dnewman - in reply to GregSzczyrbak

Right directions for what specifically? That is, what problem are you attempting to solve? I'll take a guess at what you want to do, but it's just a guess: convert an image to a vector outline. Search the web for "inkscape trace bitmap".

Great script !
It make the job. Thx for sharing.

Thank you very very much for sharing! It's an awesome idea
I was wondering if there is any way to run this extension from command line
I've tried "inkscape -f example.svg --verb command.extrude.openscad" but the file wont save as .scad
Any ideas?

I have no ideas myself. Running from a command line would certainly be useful. You might try posting to the inkscape mailing lists.

do you think i could run the python script without inkscape?

On Linux and OS X, I believe what Inkscape does is fork/exec the python script but likely with some choice environment variables defined. I don't know if it's piping the input/output to the process or what exactly. But if you look at the tail end of the script, you can see it has code for when it's running as main(). And it does import a number of modules from Inkscape's extensions/ directory so that has to somehow be in Python's search path for importing modules. (Likely, the forked process has that as its current working directory.) Unfortunately, the last time I looked (two years ago?), there was no Inkscape documentation on how extensions are run or what their expected run-time environment is.

just discovered your plugin, read the source (nicely done), tested it and it works like a charm.
so I just replaced an old "svg2scad.py" script with a way more ellegant solution. thank you.

Thanks for the kind words. Some folks have put it up on github and made some enhancements,


I can't thank you enough for this tool. I've been using it a ton in my latest project. It makes moving from illustrator into .SCAD super easy. Thank you again.


I successfully used your plugin under Mountain Lion, but on this clean Yosemite installation I cannot seem to get it to work. I've tried the eggbot patch you suggest in the instructions, but I continually get this error: The fantastic lxml wrapper for libxml2 is required by inkex.py and therefore this extension. Please download and install the latest version from http://cheeseshop.python.org/pypi/lxml/, or install it through your package manager by a command like: sudo apt-get install python-lxml

I've held off on trying the pypi installation because the last time I went down that road I left my Python Install a smoking hole in the ground as I have NO idea what I'm doing in there.

If you can offer any suggestions I would greatly appreciate it! Your tool has been remarkably valuable and I'd love to have access to it again. Thank you very much for your time and all the great work you do for the community.


If you're running yosemite, you're on your own. I've not upgraded to it and don't plan to. (Doesn't seem to have anything to offer.)
I do not have any suggestions other than searching the Inkscape groups since this is just a generic Inkscape extension: if it's not working, then other Inkscape extensions likely aren't either.

txoof - in reply to txoof

My google FU was weak. After another 15 minutes of searching I found what I needed. And a hearty thank you for this extension!

Here's the solution for other Yosemite users:
Alternate method, Manual installation (currently required for MacOS 10.10 Yosemite): Download the latest version of the Inkscape extension (not the mac installer) from the EggBotCode Google Code site. Copy the entire contents of the Eggbot software archive to /Applications/Inkscape.app/Contents/Resources/extensions/ and restart Inkscape.

Eggbot Site:

The full rundown can be found here:

Comments deleted.

Super handy and just works, thanks!

Oct 31, 2014 - Modified Oct 31, 2014

Trying to openscad but cant rendering and like this
Compiling design (CSG Tree generation)...
Compiling design (CSG Products generation)...
WARNING: Duplicate vertices and/or intersecting lines found during DXF Tessellation.
WARNING: Modify the polygon to be a Simple Polygon. Render is incomplete.
WARNING: Duplicate vertices and/or intersecting lines found during DXF Tessellation.
WARNING: Modify the polygon to be a Simple Polygon. Render is incomplete.
WARNING: Duplicate vertices and/or intersecting lines found during DXF Tessellation.
WARNING: Modify the polygon to be a Simple Polygon. Render is incomplete.
WARNING: Duplicate vertices and/or intersecting lines found during DXF Tessellation.
WARNING: Modify the polygon to be a Simple Polygon. Render is incomplete.
WARNING: Duplicate vertices and/or intersecting lines found during DXF Tessellation.
WARNING: Modify the polygon to be a Simple Polygon. Render is incomplete.
WARNING: Duplicate vertices and/or intersecting lines found during DXF Tessellation.
WARNING: Modify the polygon to be a Simple Polygon. Render is incomplete.
WARNING: Duplicate vertices and/or intersecting lines found during DXF Tessellation.
WARNING: Modify the polygon to be a Simple Polygon. Render is incomplete.
WARNING: Duplicate vertices and/or intersecting lines found during DXF Tessellation.
WARNING: Modify the polygon to be a Simple Polygon. Render is incomplete.
WARNING: Duplicate vertices and/or intersecting lines found during DXF Tessellation.
WARNING: Modify the polygon to be a Simple Polygon. Render is incomplete.
PolySets in cache: 204
PolySet cache size in bytes: 1736936
CGAL Polyhedrons in cache: 102
CGAL cache size in bytes: 682556
Compiling design (CSG Products normalization)...
Normalized CSG tree has 202 elements
CSG generation finished.
Total rendering time: 0 hours, 0 minutes, 11 seconds

how i fixed


Trying to get an Inkscape bmp to scad via the extensions -> generate from path -> paths to openSCAD on Win7.

Path to openSCAD is "C:\Program Files\OpenSCAD\openscad.exe"

got an error using v2, found the v6 is out, copied the 2 files to the inkscape extensions directory, but still getting the following error :(

***** begin error

Traceback (most recent call last):

File "paths2openscad.py", line 916, in


File "C:\Program Files\Inkscape\share\extensions\inkex.py", line 221, in affect


File "paths2openscad.py", line 873, in effect

self.recursivelyTraverseSvg( [self.selected[id]], transform )

File "paths2openscad.py", line 786, in recursivelyTraverseSvg

inkex.errormsg( gettext.gettext( 'Warning: unable to draw bitmap images; ' +

NameError: global name 'gettext' is not defined

****end error

did I do something wrong?

You have a bitmap image still in your SVG. Remove it after first tracing it with Inkscapes bitmap tracing tools.

ooppss, so I was removing the newly converted SVG instead of the BMP :)

thanks for the quick reply!! :)

The link you have to eggbot extensions for OSX is for a depreciated
version (so a warning appears). The newer version is https://code.google.com/p/eggbotcode/downloads/detail?name=EggBot2.3.1.r4s.zip&can=2&q=eggbothttps://code.google.com/p/eggb...

This extension looks great so far. I have not been having luck with the DXF export after getting it to work once.
One thing I would suggest is putting some instructions on how to install it on the GitHub site. It took me a while to first realize the "plugins" folder is not where it goes, and then to realize the "extensions" folder is under "share". Then I had to figure out that it can't be in a sub-folder since I cloned from GitHub. I had to copy it to the "share\extensions" folder itself to get it working.
Once I did all that, it works!

Aug 18, 2014 - Modified Aug 18, 2014
l0b0 - in reply to noisygecko

You should be able to use PYTHONPATH to include the extensions directory when using the code. If not you may want to create an issue at https://github.com/l0b0/paths2openscad/issues

I have no connection to the github repo. You should contact whomever is responsible for it.
As to installation directions, they are part of this Thing here. There's the Description section which appears when you first visit any Thing in thingiverse. But there's also a Instructions section. That section for this Thing has fairly complete directions including where to place the extension. Since I do not own, control, or otherwise have any connection to the github repo, I cannot place instructions there. Moreover, if instructions were there that would be a maintenance problem: there would then be two sets of instructions to keep in sync.

For the love of all things 3D; if you have no connection to the github repo, please remove the link.

Aug 18, 2014 - Modified Aug 18, 2014
l0b0 - in reply to bioradio

I am responsible for the GitHub repository at https://github.com/l0b0/paths2openscad - you can contribute suggestions and issues there. I'm not sure why you think the link should be removed, especially since some minor development still happens there.

Hi, I've had a scaling issue with the plugin; maybe you can spot where I went wrong from my description or maybe it's a bug. See here: http://www.thingiverse.com/thing:169068http://www.thingiverse.com/thi...

Basically, the resulting SCAD seems to be almost exactly 80% of the proper scaling. The SCAD source includes scale factors of 25.4/90, so apparently the coordinates exported from Inkscape are expected to have 90 units to the inch? This would seemingly need to be 72 units / inch to give me the right size SCAD forms. What do you think?

Pibow VESA 200 raspberry pi case mod [3D print version]

You need to fix your SVG to have units or correct units. SVG files should specify the units used (cm, ft, in, m, mm, pc, or pt) and if no units are specified then user units are assumed as per the SVG specification. Moreover 1 user unit is defined to be 1px. Further, the conversion from px to mm is 90px to 25.4 mm. (More precisely, 90px is defined to be 1inch.) So, if things are scaled improperly, the issue is likely with your SVG and you need to correct the usage of units in your SVG file.

P.S. Technically, if no units are specified then the measurement defaults to "user" units. But 1px is defined to be 1 user unit so you can use them interchangeably.

I'll look into the SVG. Do you have thoughts on why I would end up with 72 units / inch being the correct scale instead of 90?

Whatever software you used to create the SVG must have decided to use 72 units / inch. It should have, using standardized SVG, specified that it was using units of printer's points, pt, which are 72 pt to 1 inch. Looks as though it didn't, or there's a bug in the openscad converter which isn't handling the unit specification correctly.

Hola, si yo lo convierto en vector primero, lo hago como dice el video tutorial de you tobe,de como pasar jpg a stl y no lo encuentro despues nose donde lo archiva.. saludos y gracias por responder

Hola, instale Inkscape y cargue la extension de Paths to OpenSCAD, pero cuando hago todo el procedimiento para pasar JPG a STL, no se donde va el archivo, no lo encuentro alguin me puede ayudar??

The converter only operates on SVG vector elements. It does not operate on images embedded in SVG. You need to convert the images to vector graphics first. Inkscape does have a bitmap trace function which might be able to do that, but it also leaves the bitmap in the file and you have to then remove the embedded bitmap.

Running OSX 10.8.5 but when I select the Paths to OpenSCAD extension, I see a quick popup window that it's working, but no file is created. Seached entire drive with Finder JIC it was put somewhere else. Any ideas?

Works fine for me on OS X 10.7 and 10.9. When you run the extension, there's a popup window entitled "Paths to OpenSCAD". In that window, you select an output file name. (Default is a file in your login directory and with the extension .scad.) The conversion isn't done until you click the pop-up window's "Apply" button. If you're not getting the initial pop-up window, then something is wrong with your Inkscape or Python installation. If you get that window but no output file when you click the Apply button, then you may have a permissions problem.

Is there a summary somewhere of how this approach compares to the Export DXF method?

No. But the obvious difference is that this approach puts out a format from which a 3D model in STL, OFF, DXF, or CSG can be saved: open the .scad file in OpenSCAD, render it, and then write as a 3D model. If you produce DXF from Inkscape, then you only have a 2D rendering in DXF. You may then be able to extrude that in SolidWorks or similar.

Oh, you can't use OpenSCAD to extrude the imported DXF? (I went ahead and used your code for my purpose already and it worked very nicely; thank you!)

You can try: I've not had much luck. The Save As... DXF in Inkscape for me at least produces DXF which OpenSCAD does not support. I tried a simple circle and output it from Inkscape with all four combinations of the two DXF options. None of the four worked with OpenSCAD.

I see; would be helpful to include this information in the description. Thanks again!

Hey. Just wanted to say that you are my hero. I've been trying to model/print out a project for about a year now without much luck. I read about your script and thought, what the heck. It took a little while, but I'm in the middle of printing it (successfully) now.

Of course, now that the 'simple project' worked, I'm trying a more complex version. (SCad's been running for about 2 hours now and I'm ~10% done:)

Seriously, thank you for putting this out there. And thanks from my 3d animation friends b/c I'll stop bugging them!

When I run this I get:

terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct null not valid

Inkscape 0.48, version 5 of your tool.

That's an Inkscape bug which depends upon what platform you are using. I myself do not see it on OS X 10.7.5 nor on Windows 7 with Inkscape 0.48. Consequently, I cannot diagnose it. However, stwice a while back did some spelunking and determined that on his/her computer a cosmetic change in the .inx file resolved the issue. I've uploaded a v6 that implements that change at the expense of not presenting quite as nice of a pop up window. (The .inx file describes to Inkscape what the window should look like. Inkscape creates the window, not the extension. And, it seems, that Inkscape still has some bugs in this department -- extension dialogs.)

v6 Works Great. I'm using ubuntu 12.04 so it looks like a linux version issue. Thanks for the quick fix! I love this tool.

Thanks for the follow up -- it is appreciated. Especially in as much as I simply could not reproduce this one myself.

Is there a public repository for this? I'd love to keep up to date with the code rather than the "thing", and maybe clone to help out.

No public repo. Feel free to make one yourself and post back.

Thanks. And it's now noted in line 3 of the description.

I got the below message when I open Inkscape, opened one of the samples, and started the extension.

[email protected]:~$ inkscape
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct null not valid
Emergency save activated!
Emergency save completed. Inkscape will close now.
If you can reproduce this crash, please file a bug at http://www.inkscape.orgwww.inkscape.org
with a detailed description of the steps leading to the crash, so we can fix it.
Aborted (core dumped)
[email protected]:~$


Charles, another user tracked this down to a known (via google) issue with Inkscape and .inx file. v6 appears to remedy this on Ubuntu 12.04 at least. (I never had any luck reproducing it myself on OS X nor Windows.)


  1. I found an error in a fix I uploaded last night. So, in a few minutes there will be a fix to the fix.

  2. As to Inkscape itself aborting, that suggests a bug in Inkscape. The extension is merely a Python script which Inkscape launches. It reads some data from Inkscape, does its work, writes its own output file (which Inkscape doesn't know or care about), and then exits. It passes no information back to Inkscape. If Inkscape is then crashing, that suggests a bug in Inkscape, possibly associated with running extensions but outside the control of the extension. (If this is a Mac with Lion, there's a known bug in Inkscape 0.48.x with extensions. However, your prompt of "lenovot420" suggests otherwise.)

Thanks for the report,

Using Mac 10.6.8 + inkscape 0.48.2, I get this error when using the extension:

Traceback (most recent call last):

File "http://paths2openscad.pypaths2openscad.py", line 912, in <module>


File "/Applications/Inkscape.app/Contents/Resources/extensions/http://inkex.pyinkex.py", line 215, in affect


File "http://paths2openscad.pypaths2openscad.py", line 869, in effect

self.recursivelyTraverseSvg( [self.selected[id]], transform )

File "http://paths2openscad.pypaths2openscad.py", line 781, in recursivelyTraverseSvg

if not self.warnings.has_key( 'image' ):

AttributeError: OpenSCAD instance has no attribute 'warnings'</module>

Thanks for posting that. I'll fix it. However, realize that the underlying problem is that you tried to process an Inkscape drawing with an image in it. The converter was intentionally aborting the operation. It then encountered an error as it was trying to tell you why it was aborting the operation. Had it successfully told you what the problem was, it still would have aborted. It just would have done so gracefully.

So, even when I fix this you still will be unable to process that Inkscape drawing or SVG file. You have to remove the image from it. Either that, or put the image in another layer and deactivate that layer. Or only select the part of the drawing you want converted, omitting the image.

Thanks for the explanation. Yes, there was an image, as the svg was a traced bitmap. Out of curiosity, why is it impossible to ignore images when creating the output?

They can be ignored. What's not possible is for the extension to read your mind and know if you wanted it ignored or not.

OpenSCAD doesn't do images, so why would it ever be useful to include them in the output?

  1. OpenSCAD doesn't do SVG (either)1. SVG does do images.
  2. The point behind this extension is to convert SVG to OpenSCAD
    Thus people may incorrectly assume that this extension converts images in their SVG document to OpenSCAD.

Humans are good at learning. The extension leaves it to humans to figure out what to do with their SVG elements that cannot be handled by the extension. For example, they can use the "bitmap trace" capabilities of Inkscape to convert the image to SVG paths and then convert those paths to OpenSCAD. Or humans can decide that the bitmap was to be ignored and remove it from the document or otherwise hide it.

I am using inkscape 0.48 on Ubuntu 13.04; I have downloaded v3 of the perl script and inx file and placed it in ~/.config/inkscape/extensions. Every time I run the script I get an internal error. Running from the shell shows the following additional information. All other scripts work fine. Can you advise please?

terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct null not valid

That's an error from Inkscape and C++. The extension itself is Python code. If it was a problem with the extension code, you'd see a Python error and not a C++ error. Your issue is with Inkscape proper and you need to bring it up on an Inkscape forum. It may be that the extension is not properly installed (e.g., permissions) or some other problem. But this is not the extension itself. The extension doesn't even provide output which Inkscape reads back. Which is to say, it's not even possible for the extension to be providing incorrect output back to Inkscape.

Also, Ubuntu 13.04 is very new. It's not even clear if Inkscape 0.48 works correctly on Ubuntu 13.04. Another reason to brink this up in an Inkscape forum.

I had the same problem, but finally found a solution after some googling: inkscape does not seem to like empty _param elements in the .inx extension descriptor. After removing the empty _param element with name="footer" the extension works fine.

Thanks for pointing this out. I cannot reproduce the problem on OS X 10.7.5 nor Windows 7. But I've gone ahead and posted v6 with a modified .inx file. Thanks.

I can't use it, when I try on osx 10.7.5 running python 2.7.1, it fails and tells me to install the 'fantastic lxml wrapper'. And that, is effectively impossible for me. I googled for 20 minutes trying to figure it out and it's a no go. Has anybody here gotten this working using the above mentioned versions? Thanks.

dnewman - in reply to

Runs fine on OS X 10.7.5 for me with Inkscape 0.48. The version of Python which Inkscape runs is often/typically not the version you see from the command line. As to the missing lxml, that is a generic Inkscape installation issue. You would be best to post to the Inkscape users group.

Ok, thanks for the help and if you want the plugin to work with Inkscape 0.48 on mac 10.7.5 then this patch mentioned below worked for me. I removed Inkscape installation just to be sure, re-installed from the 'snowlion-universal' dmg then installed the eggbot patch. Now it works. Thank you.

I have written a workaround patch and made it available for download (as part of the Eggbot extensions for Inkscape), for anyone needs a short-term workaround for this issue-- that is, before an official solution is released by the Inkscape developers.

You can download it here: http://code.google.com/p/eggbotcode/downloads/detail?name=EggBot2.2.2.r2.mpkg.ziphttp://code.google.com/p/eggbo...

Full disclosure:
A. This is a totally unofficial hack, not endorsed in any way by the Inkscape developers. :)

B. The download is a standard Mac installer package for the Eggbot extensions for Inkscape, which installs the following software:

1) The Eggbot extensions for Inkscape, a set of Inkscape Extensions for creating drawings for and operating an Eggbot,
2) The Hershey Text extension for Inkscape, a "render" extension for drawing stroke-based text, and
3) The patch to Inkscape.app, for version 0.48 and newer, which allows extensions to operate properly under MacOS 10.7.

C. This is free software, licensed under the GPL, released in the hopes that it will be helpful, but released strictly on an as-is basis.

txoof - in reply to

The patch you link to above is dated from 2011. Is there a newer patch? I keep getting the same error you mention at the start of this thread.

txoof - in reply to txoof

I have tried backing down to 0.47 and several releases between that and 0.48.2. Each time I have run the eggbot patch linked to in the instructions, but with the same result: please install the lxml wrapper...
I've purged everything in the ~/.config directory just to be sure and reinstalled inkscape several times. Any help would be greatly appreciated!

txoof - in reply to txoof

The following eggbot patch does the job under ML 10.8 with Inkscape 0.48: https://code.google.com/p/eggbotcode/downloads/detail?name=EggBot2.3.1.r3s.mpkg.zip&can=2&q=https://code.google.com/p/eggb...

Everything appears to work, but now I get the following errors when I try to compile:
Parsing design (AST generation)...
Compiling design (CSG Tree generation)...
Compilation finished.
Compiling design (CSG Products generation)...
ERROR: CSG generation failed! (no top level object found)
PolySets in cache: 17
Polygons in cache: 4328
CGAL Polyhedrons in cache: 59
Vertices in cache: 14412

Any idea what might be going on?

Without seeing the actual OpenSCAD file, I have no way of knowing what the issue might be. You can send me the file using my e-mail address.

dnewman - in reply to

Head slap! With my involvement with Eggbot development, you'd think I would have remembered that patch.... Indeed, it's why, ummm, things work for me on 10.7.5. (I didn't make the patch, but I tested it for Windel.) Sigh. I'll mention this in the instructions above.

Oh, and don't bother with the 'ports' or 'macports' or 'homebrew' - I tried it all, none of it worked for me and probably left my mac's python zone a diaster area. The eggbot patch worked. Nothing else did.

And, I can confirm that on OS X 10.7.5 there is a known Inkscape issue with their latest distro, 0.48.2-1-SNOWLEOPARD.dmg that will give you that error. It's a generic Inkscape issue and not specific to this extension. You should take this up in the Inkscape forums. Or, run an older version of Inkscape. I'm using 0.48.2 r9819 on my OS X 10.7.5.

Lastly, your plugin works nicely and I appreciate it. Mahalo.

Nice plugin, but I keep having inkscape crash on me when I am trying to use it on a particular SVG. Any Advice?

That's a bug in Inkscape then. Extensions do not run within Inkscape. Inkscape writes the SVG to a temporary file and then Inkscape launches a separate process -- concurrently runs another program as though that program is another user. That separate process runs Python and executes the extension which reads in the SVG and then writes it back out again. Inkscape waits for that separate process to finish and then reads back in the SVG output by the separate process. If Inkscape is then dying, then Inkscape has a bug of some sort. While it's possible that the extension is putting out SVG which isn't what Inkscape wants to see (and may even be bad SVG), Inkscape should not crash. Instead it should report an error message.

So, you may want to make sure that you are running a recent version of Inkscape. OTOH, this may be a new bug in Inkscape. Also, it could be that the extension is putting out incomplete SVG, but I'd have to see the input file fed to the extension by Inkscape to tell. (It's some intermediate form of the SVG file you loaded into Inkscape.) Armed with that input and if there's a problem in the extension, then I could fix that. However, the bug in Inkscape would still remain -- the bug that makes it crash when it sees extension output it doesn't like.

Thanks for the fast reply. I managed to get it to work. The SVG was originally made in Illustrator, which seemed to be causing the problem. Pasted the objects into a new SVG, converted to paths and it processed with no errors. The only odd thing I have noticed is that it doesn't like to render paths within a void if the void is within a filled solid, so for instance if I have a circular filled object, render a circular space through Paths -> Difference, then another solid circle within that space (think a bullseye), the inner most part of the circle does not want to always render.

It is a fantastic plugin and has saved me a heck of a lot of work. Promised my fiancee a custom wax seal for our wedding invites, and this is making it go faster. Just have to tinker a bit to get it how I want it to.

can it convert arc or circle to arc, not to poligon?

No. Largely in part because Inkscape itself tends to use cubics for much of what it does anyway.

I just want to note for Mac users to remove the leading tilde and slash and to check in Inkscape.app/Contents/Resources/extensions for your files.

For some reason because Inkscape is using X11, it save the file in the actual .app bundle. If I save it to "~/filename.scad", I haven't been able to find it, whereas "filename.scad" appears in the the bundle.

Thanks for posting this tip!

Alternatively, replace ~ with /Users/your-account-name/ to put it in your login directory or /Users/your-account-name/Desktop to put it on your Desktop.

At issue will be what does the HOME environment variable translate to in the process which Inkscape forks to run Python and the extension script. This can conceivably change with the X11 implementation (there are several for OS X), the Inkscape version (many), and maybe even your account's .profile file or other (hidden) login scripts. Hard to say. I'm a Mac user and I don't see this behavior on OS X 10.7.5 (Lion). But clearly YMWV (your mileage will vary).

The nesting works perfectly, great job! This converter will definitively be part of my tool chain from now on. Thank you very much!

Thanks for the feedback. It is helpful!

I may add support for arbitrary depth within a path. Handling nesting between paths and clipping within a path and between paths may be overkill AND would definitely introduce dependencies on add'l Python libraries as well as some C/C++ shared libraries. Fortunately, an Inkscape user can simply
rearrange their paths to deal with those issues: it doesn't have to be dealt with in the converter.

And I need to plant to look at Polymaker's path converter for possible inclusion.