Coding 3D Models Using Tinkercad Codeblocks – SCOPES Digital Fabrication

You need to login or register to bookmark/favorite this content.


Nettrice Gaskins
Nettrice Gaskins
K-12 teacher
Dr. Nettrice Gaskins has worked for several years in K-12 and post-secondary education, community media and technology before receiving a doctorate in Digital Media from Georgia Institute of Technology in 2014. She has focused on the application of cultural art… Read More


Inspired by contemporary South African baskets and hats, this activity explores craft through computation, 3D modeling and 3D printing. Students will use object-oriented computer programming, meaning they will place a predefined object on a work plane and modify it using code. Once models are generated students can export them as an .stl files and 3D print them.


In addition to Fab I Can and Common Core Math, this lesson is aligned with the CSTA K-12 CS Standards and the ISTE Standards for Students.

What You'll Need

Computers, Internet, Tinkercad (a free, easy-to-use, web-based 3D CAD design tool); optional, but useful: 3D printer, color printouts of the Codeblocks used in this lesson.

The Instructions

Build Some Context Around Math & Coding

How can mathematicians or computer scientists be more like artists? Making patterns is one thing they all have in common. A pattern is a repeated decorative design.

The study of pattern is the foundation of mathematics. It is the thread that binds all parts of mathematics together. In coding – like in math – patterns are made from ideas. Mathematicians and computer programmers use patterns to express themselves and to make their work more efficient. For example, they might use loops to allow for the repetition of a sequence of code multiple times.


Artists and crafts people such as the ones in southern Africa, produce objects with cultural patterns. The steps they take to create the patterns is similar to the way designers create 3D models on computers.


Have students look at some examples of patterns in cultural artifacts such as South African baskets and hats. Have students or small groups of students pick one example and have them identify a shape pattern that follows a given rule. For example, triangles are common shapes in Zulu baskets. Students can use these shape patterns to explore triangular numbers.



Give Students Some Code to Play With

One of the best ways to introduce coding to students is to have them play or tinker with existing code. Also, introduce relevant vocabulary to them such as variables, transformation (rotation, scale) and repetition.

Discuss terms such as “variable” which is stored in a code file and, when paired with an associated symbolic name or identifier, contains some known or unknown quantity of information referred to as a “value”. “Repetition” means repeating a sequence of instructions a certain number of times, or until some specific result is achieved. A “loop” is a sequence of instruction (algorithm) that is repeated until a certain condition is reached. By repeating an instruction, students can generate patterns.


Have students start using Codeblocks in Tinkercad. The first step (for teachers) is to set up an account for each student.


Once students are logged in, they have to choose Codeblocks from below their profile image on the main web page. On the next screen, they can choose “New Design.”


When they are inside the Codeblocks editor, they can copy the script below to make a random shape generator.



Use this Autodesk tutorial to help students get going:

Create the Basket or Crown

Students simulate the process of weaving a basket in Codeblocks by taking advantage of coding aspects like loops and variables to control and iterate your designs.

In traditional Tinkercad, students build models by dragging basic shapes like a box, cone, or wedge onto the work plane. Codeblocks is similar, but rather than dragging a shape out to the work plane and then resizing it, they drag a block of code for an object whose parameters they can adjust.


The basket/hat in the example below consists of a three-sided torus shape that is repeatedly rotated up and around 20 times to form a circle (or crown).