OpenSCAD Tutorial

Lesson 1 · Your First Shapes

Place a cylinder

cylinder(h = 12, r = 5) stands upright along Z, with its base centered on the origin. r is the radius; use d for a diameter. Give it r1 and r2 to make a cone.

translate([x, y, z]) moves the shape that follows it. Lesson 2 covers transforms in detail. Note that the transform has no semicolon; the shape it applies to does:

translate([35, 5, 5])
  sphere(r = 6);

Shapes written one after another are combined into a single model.

Your task: keep the 20 × 10 × 5 cube and add a cylinder with height 12 and radius 5, moved to [30, 5, 0] so it stands next to the cube. Use $fn = 64 to make it round.

Loading the OpenSCAD editor…
Step 2 of 16