BlocksCAD is an official Hour of CodeTM Activity.
BlocksCAD is a free online software designed to teach students coding and Computer Aided Design.
During this Challenge, students will use BlocksCAD to create a 3D design for a snowflake by writing a program to rotate a shape around an axis (using a loop).
Overview and Background
Students will create a 3D design for a snowflake by writing a program to rotate a shape around an axis (using a loop). By changing the shape to be rotated, and the number and size of the rotations, you can easily customize the snowflakes.
To do this lesson in BlocksCAD, students will have to learn how to
- Create Shapes
- Translate (move) shapes around a three-dimensional coordinate system
- Rotate shapes
- Use a loop to repeatedly rotate our shape to create a snowflake
Below, we’ll go through these steps in the process of creating a very simple snowflake. The end result will look like this. (click Render to see simple snowflake)
We recommend that educators first go through these simple steps to get familiar with the lesson, and then go through the same steps with students to teach them how to use BlocksCAD. After you’ve done these steps together, students can then customize their snowflakes to make amazing & intricate designs!
The instructions that follow can also be found as a PDF and Word document in the "Things Files" section.
We have a playlist of videos at our YouTube Channel that show how to do all the skills necessary to do this project (Shapes, Translation, Rotation, Loops).
Lesson Plan and Activity
● Students will combine Loops with Translation transformations, using appropriate arithmetic operations to execute their designs.
● Students will combine iterative loops with rotational transformations, creating rotationally symmetrical designs.
● Students will use loops to drastically reduce the amount of repetitive coding they need to use in a model.
● Students will utilize programmatic loops to create code which executes repeatedly with small variations
● Students will use loops to make flexible models, which can be drastically altered by changing values in only a few locations.
We are including a step-by-step process to create a simple snowflake. We recommend that you do this with your students to teach them the basics, and then let them go wild customizing their snowflakes!
1 - Creating Shapes
To create a cube shape, click on the “3D shapes category”, then drag a cube out onto the white working area.
You can change the numbers for the X, Y, and Z dimensions of the cube.
Next we’ll change the cube to be long, skinny, and flat, and then center it. Here’s what the cube block looks like now:
Make sure to hit the Render button every time you change your blocks so that you’ll see the result of your changes.
Let’s add a second cube that is long in the Y dimension. When you render the two cubes, you’ll see this:
2 - Translate (move) shapes around a three-dimensional coordinate system
Next, we’ll move the cubes so that they make a lopsided cross-shape with one corner at the origin. To move shapes, we’ll need the “Translate” block - ‘translate’ is the mathematical word for moving a shape in space. You’ll find the Translate block in the “Transforms” Category (the third category - it is dark blue).
To use the translate block, snap it around the shape you want to translate, and enter how much you want to move it in the X, Y, and Z directions (decimals and negative numbers are allowed).
Still having trouble translating shapes? Watch our Translate video on YouTube.
3 - Rotating Shapes
To rotate a shape (or shapes), we’ll need a rotate block (all rotations are in degrees). That is the second block found in the “Transforms” category. To put more than one shape inside, click the “+” icon in the upper left of the block.
Shapes can be rotated around the X, Y, or Z axes. Students are often confused which axis to rotate around at first. Encourage your students to use trial and error - first rotate a shape around the X axis, and see if it was what they wanted. If not, set the X rotation back to zero and then try the Y axis, and repeat with all the axes until you find a rotation that was what you wanted!
Notice also that shapes don’t rotate around the shape’s center, but around the origin of the coordinate space (0,0,0).
You can also watch (and show your class) this video for more information on rotating shapes.
(link to rotation, part one and rotation, part two)
Rotating our cubes by 45 degrees around Z would look like this:
Still having trouble rotating shapes? Watch our Intro to Rotation Video on YouTube.
4 - Using a Loop to repeat the rotation in a ring
In programming, we can repeat an action over and over by using a “loop”. The loop block in BlocksCAD looks like this (found in the “loops” category):
The loop works by counting with an “index variable”, i. The variable i is just a label for our count. If we have our loop count from 1 to 3 by 1, it would repeat 3 times like this:
Count #: 1 2 3
Value of i: 1 2 3
We’ll use the variable i in our program as we rotate our shape.
Put the rotated shape from step 2 into a loop block. Change the loop block to count from 1 to 360 by 60 (this will give us our rotation angles: 1, 61, 121, 181, 241, 301). Lastly, go to the “variables” category and get the variable “i” and put it in your rotate block. Your code will look like this:
Want more information on Loops? Watch our Using Loops video on YouTube.
Congratulations! You’ve made a simple snowflake. Now the fun begins!
- Change the shape you rotate. You can make very fancy shapes by arranging cubes, and also check out the torus - you can configure this shape to be triangles, squares, etc by changing the number of sides the torus has. Keep the number of torus faces small so that rendering doesn’t take too long.
- Change how many degrees to rotate by so that you get a different number of copies of the shape. This can be a great math exercise for your students - teach them that to figure out how many degrees to count by, they can divide 360 by the number of copies of their shape they want. If they want 9 copies of the shape rotated around, they’d calculate 360 / 9 = 40. Count by 40 degrees in the loop, and they’ll see 9 copies of their shape.
- Use two or more shapes, each with its own number of rotations.
- Advanced: Create an angle variable and use the Math block to calculate the exact angle of rotation required for a defined number of loops.
To submit a snowflake for the contest, you’ll need both the “xml” file (which is the block program) and the “stl” file (which is the snowflake model that can be sent to a 3D printer).
(Note: An STL file cannot be turned back into editable blocks in BlocksCAD, which is why you may want to save the Blocks file as well.)
From the editor, you can download the files like this:
As a teacher, you can easily get to any of your student projects to download the .xml and .stl files if you are using a BlocksCAD for Education account (free trial available). You can create a BlocksCAD class, have your students join with a code, and then you’ll have access to all their projects.
Here’s what your educator dashboard would look like from a class page in BlocksCAD:
Simple Snowflake One-Pager (found in "Thing Files")
Computer with a browser (a mouse is also recommended)