OpenSCAD User Manual/3D to 2D Projection

From Wikibooks, open books for an open world
Jump to navigation Jump to search


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(the default), points above and below the plane will be considered as well (creating a proper projection).

Example: Consider example002.scad, that comes with OpenSCAD.

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();

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();

Openscad example projection 8x.png

Another Example

You can also use projection to get a 'side view' of an object. Let's take example002, and move it up, out of the X-Y plane, and rotate it:

translate([0,0,25]) rotate([90,0,0]) example002();

Openscad projection example 4x.png

Now we can get a side view with projection()

projection() translate([0,0,25]) rotate([90,0,0]) example002();

Openscad projection example 5x.png

Links: