OpenSCAD ist a really cool tool for simple solid modeling. However, the built-in shapes naturally have their limitations, and one option for getting more details is to import SVG files.
Here’s how you can do it:
- Create or import your SVG in Inkscape
- Ungroup all groups (select all, Object -> Ungroup, possible repeat this several times depending on your SVG)
- Use Extensions -> Modify Path -> Flatten Bezier (a flatness of 1 yields reasonable results, try out what works best)
- Save as DXF file
- Use it in OpenSCAD with the “import” statement, and give it some height with the “linear_extrude” statement (see sample code below)
- Depending on what you’re modeling, you may want to invert your structure using the “difference” operation (like in the example below)
Here’s an example of an SVG (converted to dxf) file (from http://www.patterndesigns.com/en/design/819/Aramis-Braun, curtesy of Pattern Design) being used to build a simple but nice tea candle lamp …
… and here’s the OpenSCAD code
size = 360; module baroquePattern() { difference() { translate([0,0,0.5]) cube(size=[size,size,1]); linear_extrude(height = 2) import (file = "D:\\baroque.dxf"); } } plateSize = size * 2; module baroquePatternPlate() { //create a 2x2 plate from the original repeatable element baroquePattern(); translate([size, 0, 0]) baroquePattern(); translate([0, size, 0]) baroquePattern(); translate([size, size, 0]) baroquePattern(); } rotate([90, 0, 0]) baroquePatternPlate(); translate([0,plateSize,0])rotate([90, 0, 0]) baroquePatternPlate(); rotate([90, 0, 90]) baroquePatternPlate(); translate([plateSize,0,0]) rotate([90, 0, 90]) baroquePatternPlate();