2022-04-07 - importing SVG in OpenSCAD

that's simple – there's import() call in OpenSCAD, that handles that, right?


and we're done! except we sometimes don't…

i've been using import() in the past w/o issues. yet recently, i stumbled across model made by some1 else, that failed to import correctly. when rendering, it thrown:

ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron., location unknown.

quick duck-ducking and it turned out, that some programs make tiny holes where self-intersecting polygons are and this causes issues. manual edition was not an option, because model could be changed in the future and trial-and-error search for such spots would be a real pain in the back. more over OpenSCAD does not close open paths (see known limitations of import() module for SVG files). so how do you close these?

turned out there is a nice trick to overcome this – using offset() module from OpenSCAD, with some small value as a parameter:


…and boom! the problem solved! offsetting closed micro gaps, forming a correct, closed shape. the nice thing is that one can use this technique on any model. in fact i now start to use it everywhere, to cut myself from this kind of issues in the future. :D

blog/2022/04/07/2022-04-07_-_importing_svg_in_openscad.txt · Last modified: 2022/04/07 11:26 by basz
Back to top
Valid CSS Driven by DokuWiki Recent changes RSS feed Valid XHTML 1.0