openscad/openscad — Issue #99: Better support 2D models by adding lines
Author: nichtich
Created: 2012-03-05 12:48:05+00:00
State: open

2D laser cutting and CNC is not hyped as much as 3D printing, but it has similar potential. Although OpenSCAD has been designed for 3D modeling, you can also use it to create some flat 2D models, which can be exported as DXF files (I'd [prefer an SVG export](https://github.com/openscad/openscad/issues/98), but that's another issue).

However there is one problem: There are no simple lines in OpenSCAD! Objects that tough each other are always joined by UNION so you cannot cut them into pieces. Here is an example:

square([10,10]); translate([0,5]) circle(5);

is equivalent to

union() { square([10,10]); translate([0,5]) circle(5); }

and to

group() { square([10,10]); translate([0,5]) circle(5); }

But when you do cutting, you might want to have two pieces:

difference() { square([10,10]); translate([0,5]) circle(5); } // one
translate([0,5]) circle(5); // second

For 2D modeling there should be a command to create unfilled `outline`s from objects and a command to create unclosed `line`s (I'd also like `bezier` to draw Bezier lines but that's another issue). Outlines and lines are closed or unclosed lines in space that can also be unioned and differenced. For 3D models, simple lines should not harm, they can be used as guidelines for visualizing, but just ignored in the STL export. However, for serious 2D models we need simple lines as elements in OpenSCAD and DXF/SVG export.