Skip to main content

Repetition

Repetition is one of the most powerful elements in a progamming language. It is also very useful in 3D programming to create objects with patterns. Repetition statements allow you to create these patterns very quickly and you can change them easily at any time. Let start with a simple shape that includes a cylinder.

We can now repeat the block by dragging a repeat block from the library and insert a rotate statement inside the body. Select slanted from the rotation menu, which means that the cylinder is rotated 45 degrees every time. Set the number of times to 9.

Now we drag another repeat block and insert everything inside this block. Also add a move statement with a value of 2. This means that the object is moved 2 units for every iteration.

Finally we add a block and the shape we end up looks like a round cleaning brush. You can

It is now very easy to change the shape of the brush by changing the value of the repetition or length of the cylinder.