OpenSCAD User Manual/3D to 2D Projection
Using the projection() function, you can create 2d drawings from 3d models, and export them to the dxf format. It works by projecting a 3D model to the (x,y) plane, with z at 0. If cut=true, only points with z=0 will be considered (effectively cutting the object), with cut=false, points above and below the plane will be considered as well (creating a proper projection).
Example: Consider example002.scad, that comes with OpenSCAD. You can load it and render it to example002.stl (with F6). You can then load that stl file back into OpenSCAD, like so:
import_stl("example002.stl");
Then you can do a 'cut' projection, which gives you the 'slice' of the x-y plane with z=0.
projection(cut = true) import_stl("example002.stl");
You can also do an 'ordinary' projection, which gives a sort of 'shadow' of the object onto the xy plane.
projection(cut = false) import_stl("example002.stl");
Another Example
What if we take example002 and move it up, out of the X-Y plane? And rotate it?
translate([0,0,25]) rotate([90,0,0]) import_stl("/tmp/d.stl");
Now, you can project it and get a 'side view' of the entire object.
projection(cut=false) import_stl(“/full/path/to/stl”);
Links:
- example021.scad from Clifford Wolf's site.
- More complicated example from Giles Bathgate's blog
This page may need to be 



