OpenSCAD Tutorial

Lesson 2 · Moving, Rotating, and Scaling

Transform order matters

Read a transform chain from the bottom up: the transform closest to the shape happens first.

// Rotate first, then move: the cube turns in place and then moves along X.
translate([30, 0, 0])
  rotate([0, 0, 45])
    cube(10);

If you move first and then rotate, the cube swings around the origin like a clock hand, because rotate always turns around the origin.

A good habit: build and rotate a part at the origin first, then translate it into place last.

Your task: the cube below swings away from the X axis. Swap the two transforms so the cube turns 45° in place and then moves to x = 30.

Loading the OpenSCAD editor…
Step 6 of 16