An Introduction to Tinkercad Codeblocks

Codeblocks is a new beta addition to Tinkercad. It’s allows the creation of 3D designs using visual programming. Codeblocks includes the creation and use of variables. Values of variables can be changed to easily create designs of different sizes.

Tinkercad is a free cloud-based Computer Aided Design (CAD) environment. 
It works best using the Google’s Chrome borowser. Other browsers may be suitable.

You can sign-up at: to get a logon ID and a password. After you have signed-up, you can sign-in to your account.

Following your sign-in, Tinkercad presents a dashboard similar to the one shown below. In the left-hand columns are buttons that control what appears on your display. Our focus is on the Codeblocks button.

A Tinkercad dashboard.

Click on the Codeblocks button. Tinkercad presents a dialog (you can scroll vertically).

Starters are examples of 3-D designs created using codeblocks. These are useful for learning how to use codeblocks. Your Code shows designs that you created or modified using codeblocks.

Click on the “New Design” button at the top-right. The codeblocks development environment appears.

Codeblocks Development Environment

Drag the Box shape into the middle section and click on its arrow key (at its right edge) to expand it. Press the Run button to see the red box on a Tinkercad workplane.

The general procedure is to make changes in a codeblock (such as the Add shape above) and press the Run button to see these changes rendered on the workplane. 
Press the red circle to change the color of the box. 
The gray-white button makes the box a “hole” (more on this below). 
The directional arrow is a toggle to expand/collapse the codeblock’s variables and values. 
Replace the number zero in the Edge container and click on the Run button to see rounded edges on the box.

When a shape is added to the workplane, it’s center is placed at X=0, Y=0, Z=0.

I changed the color of the box, pressed the Run button and zoomed in to get the view below:

The coordinates icon is placed at the center point (X=0, Y=0, and Z=0) of the box shape. The X-axis (Width) is red, the Y-axis (Length) is green, and the Z-axis (Height) is blue. Note that half of the shape is below the workplane.

How can we make a round hole in top of the box?

Drag the Cylinder codeblock so that it snaps to the bottom of the Box codeblock. 
Expand it and set its Radius to 6. 
Press the Run button.
I clicked-dragged the View-Cube (in the upper left) to get:

The box and the cylinder are aligned at their centers in the X, Y, and Z planes.
Make the Cylinder a hole by clicking by clicking on its gray/white striped icon.

We want to use the Create Group codeblock. To see the Modify codeblocks, click on the Modify button in the leftmost column (as shown below).
Drag the Create Group codeblock, so that it snaps into the bottom of the Cylinder codeblock as shown below. 
Since the Cylinder is a hole, it will be subtracted from the Box, when the Create Group codeblock is executed.
Click on the multicolor icon to choose the color of the resulting object. I chose red.
Press the Run button.

I dragged the View-Cube to get:

Other aspects of the codeblocks editor include:
The codeblocks editor (center column) allows a group of codeblocks to be dragged to the trash can (at the bottom-right).

A new codeblock may be added at any place in the list of codeblocks. You create a place for it by dragging down (unsnapping) at the point of insertion.

Congratulations! You now know the basics of using Codeblocks in Tinkercad.

For more articles on Tinkercad’s Codeblocks go to:
Links and Summaries: Tinkercad Codeblocks Articles By @Tcodeblocks