OpenSCAD Tutorial
Lesson 5 · Loops and Patterns
Make a grid with two loop variables
A for loop can take several variables: for (x = [0 : 3], y = [0 : 2]) runs the body for every combination, making a 4 × 3 grid.
Inside difference(), the whole loop counts as one child, so every copy it makes is subtracted.
Your task: the plate has one row of 4 holes. Add a second loop variable y = [0 : 2] so it gets a 4 × 3 grid of holes, 10 mm apart.
Loading the OpenSCAD editor…
Step 13 of 16