OpenSCAD Tutorial

Lesson 3 · Combining Shapes

Subtract with difference

Most OpenSCAD models are a few primitives combined with three boolean operations. This is called constructive solid geometry (CSG).

  • union() merges its children. Top-level shapes are unioned automatically, but an explicit union groups them.
  • difference() keeps the first child and subtracts every child after it.
  • intersection() keeps only the volume shared by all children.

Common mistake: putting the cutter first. The part you keep always comes first inside difference().

Your task: change the union() to a difference() so the sphere scoops out the middle of the cube, leaving only its corners.

Lesson 3 in under a minute
Loading the OpenSCAD editor…
Step 7 of 16