Transformation Review

Rotate

Rotates its child a number of degrees about the axis of the coordinate system.

rotate ([90,0,0])

//rotate a cylinder 90 degrees on the x-axis

rotate ([90,0,0]) cylinder (h = 4, r=0.9, center = true, $fn=100);

Righhand Rotation Rule

Point your right thumb along the positive axis, your fingers rotate in the direction of the rotation.

Translate (Move)

Translates moves its child elements along the specified vector. The argument name is optional. translate([x, y, z])

//translate a cube 3 millimeters to the right on the x-axis

cube([2,3,4]);

translate([3,0,0]) {

cube([2,3,4]);

}

Union

Creates a union of all its child nodes. This is the sum of all children (logical or). May be used with either 2D or 3D objects, but don't mix them.

union() {

cylinder (h = 4, r=1, center = true, $fn=100);

rotate ([90,0,0]) cylinder (h = 4, r=0.9, center = true, $fn=100);

}

Difference

difference() { cylinder (h = 4, r=1, center = true, $fn=100); rotate ([90,0,0]) cylinder (h = 4, r=0.9, center = true, $fn=100); }

Mirror

mirror([x, y, z])


//mirror a cube on the x-axis

mirror([1,0,0])cube([2,3,4]);

Convex Hull

This transformation creates a minimal linear bounding container. In complicated terms, the convex hull of a geometric object (such as a point set or a polygon) is the smallest convex set containing that object. The best and simplest explanation I have heard of is “gift wrapping two objects.

hull() {

cylinder(h=2,r=40);

translate([0,0,40]) sphere(40);

}