Transforms

scale

This function scales the child elements using the specified vector. The argument name is optional.
Usage Example:
scale(v = [x, y, z]) { ... }
scale([x, y, z]) { ... }


rotate

Rotates its child a degrees around the specified vector (rooted in the origin of the coordinate system). The argument names are optional if the arguments are given in the same order as specified above.
Usage example:
rotate(a = deg, v = [x, y, z]) { ... }
rotate(a = deg, v = [x, y, z]) { ... }


Alternatively the a parameter may be a vector of three degrees. In this case the child nodes are rotated around the positive x, y and z axis (in this order) by the specified number of degrees and the v argument is ignored and may be left unspecified. For example, to flip an object upside-down, you might do this:
rotate(a=[0,180,0]) { ... }
rotate([x, y, z]) { ... }


translate

Translates (moves) its child elements along the specified vector. The argument name is optional.
Usage example:
translate(v = [x, y, z]) { ... }


mirror

This function mirrors the child element on a plane through the origin. The argument to mirror() is the normal vector on that plane.
Usage example:
mirror([ 0, 1, 0 ]) { ... }


multmatrix

Multiplies the geometry of all child elements with the given 4x4 transformation matrix.
Usage:
multmatrix(m = [...]) { ... }
Example (translates by [10, 20, 30]):
multmatrix(m = [ [1, 0, 0, 10],
                 [0, 1, 0, 20],
                 [0, 0, 1, 30],
                 [0, 0, 0,  1]
               ]) cylinder();


color

Displays the child elements using the specified RGB color + alpha value. This is only used for the OpenCSG and Thrown Together display modes. The alpha value will default to 1.0 (opaque) if not specified.
Usage example:
color([r, g, b, a]) { ... }
Note that the r, g, b, a values are limited to floating point values in the range { 0.0 ... 1.0 } rather than the more traditional integers { 0 ... 255 }. However you can specify the values as fractions, e.g. for R,G,B integers in {0 ... 255} you can use:
color([ R/255, G/255, B/255 ]) { ... }


minkowski

Displays the minkowski sum of child nodes. Minkowski or vector sum of a cube and sphere can be thought of this way:
The center of the sphere is the reference point. Move the reference point everywhere in the cube and then take the union of all the resulting infinite number of spheres. The solid form that results from the union is the cube that is slightly bigger than the original cube by the radius of the sphere and with rounded corners.

The Minkowski sum of any two solid shapes is a well defined set and the reference point for the shape that moves does not have to be a sphere.

Usage example:
$fn=50;

minkowski(){
 cube([10,10,1]);
 cylinder(r=2,h=1);
}


hull

Displays the convex hull of child nodes. Think of saran wrapping the shapes:
Usage example:
hull() {
   translate([15,10,0]) 
   circle(10);
   circle(15);
 }
hull() gives a 3D convex hull of all child objects, think wrapping a sheet around things, so you can position some cylinders and spheres where you want corners, then hull() and you get a rounded cube.

demonstration of what you can do with hull()





hull()