411 REFERENCE · Wikibooks
OpenSCAD User Manual/3D to 2D Projection
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
__NOTOC__
Using projection(), 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 are considered (effectively cutting the object), with cut=false(the default), points above and below the plane are considered as well (creating a proper projection).
Example: Consider example002.scad, that comes with OpenSCAD.
File:Openscad projection example 2x.png
Then you can do a 'cut' projection, which gives you the 'slice' of the x-y plane with z=0.
projection(cut = true) example002();
File:Openscad projection example 3x.png
You can also do an 'ordinary' projection, which gives a sort of 'shadow' of the object onto the xy plane.
projection(cut = false) example002();
File:Openscad example projection 8x.png
Another Example
You can also use projection to get a 'side view' of an object. Let's take example002, rotate it, and move it up out of the X-Y plane:
translate([0,0,25]) rotate([90,0,0]) example002();
File:Openscad projection example 4x.png
Now we can get a side view with projection()
projection() translate([0,0,25]) rotate([90,0,0]) example002();
File:Openscad projection example 5x.png
Links:
More complicated example from Giles Bathgate's blog