TinkerCAD Codeblocks: Everything You Need to Know

 |  Chhavi Malik

What You Need to Know About TinkerCAD Codeblocks

An engaging and entertaining way to learn the fundamentals of computer programming is with the Tinkercad Codeblocks workspace. Press Play after dragging and stacking Codeblocks to observe TinkerCAD construct a unique 3D model from your code.

With TinkerCAD, users of all skill levels can easily understand and remix Codeblocks code since it employs the same familiar shapes found in TinkerCAD's 3D workspace. The variables and parameters in Codeblocks make it easy to build complicated designs with repeated patterns. (And some basic mathematics also!)

Most importantly, TinkerCAD codeblocks provides a graphical interface for investigating the impact of incremental modifications to code. Creators have more control and precision when they use block code to interact with a 3D design. While you learn to put code to work for you, you can refine your Codeblocks design through iterative processes.

How to Use Codeblocks Feature in TinkerCAD?

To obtain a login ID and password, you can complete the registration process at TinkerCAD website. You will be able to access your account when you have registered. As soon as you log in, TinkerCAD will display a dashboard that looks like the one below. The buttons that you use to change the content of your screen are located in the columns on the left. Keep the Codeblocks button in mind.

TinkerCAD blocks

Select Codeblocks from the menu. You may scroll vertically in TinkerCAD's dialogue. With Codeblocks, you can make 3-D patterns like the ones in Starters. If you're new to Codeblocks, they will come in handy. You can see the designs you made or edited with Codeblocks in Your Code.

Select the "New Design" option located in the upper right corner. It starts with the Codeblocks development environment.

TinkerCAD designs

To enlarge the Box shape, drag it into the center area and then click on the arrow key (on the right side) to make it bigger. The red box will appear on a Tinkercad workplane when you press the Run button.

Run option in TinkerCAD

In general, you can see your changes made on the workplane when you push the Run button after editing a Codeblock (like the Add shape above). Select a new colour for the box by pressing the red circle. Adding the gray-white button transforms the box into a "hole".

The direction arrow acts as a toggle that allows you to open or close the variables and values of the codeblock. To make the box's corners seem rounded, simply click the Run button after replacing zero with the value from the Edge container.

Inserting a shape onto the workplane causes its center to be located at X=0, Y=0, and Z=0.

Newly Added TinkerCAD Codeblocks 

1. Templates

Being efficient is frequently crucial in the realm of coding. New Template Blocks are here to make your creative process faster and easier. You can add these blocks to your design as often as you need them because they describe reusable shapes. Picture them as laying out a blueprint for a shape that you may instruct Codeblocks to construct repeatedly. Because of this, re-stacking the same code is no longer necessary.

You may also use templates to make changes to your custom shapes all at once, rather than having to go through piles of code and adjust each one individually.

When working with a complicated or busy design, it can be helpful to collapse several Template blocks, as seen in the following example. You can view what's inside by expanding them again.

TinkerCAD templates

2. Set Color RGB, HSB

One of the best ways to make your designs stand out is to include color in them. You can now accomplish this with two new blocks in Tinkercad Codeblocks: Set color RGB and Set color HSB. You may now freely experiment with different hues owing to these new blocks that let you dynamically adjust color using variables.

Determine the hue in order to create a color, the RGB block uses a scale from 0 to 100 to indicate the relative amounts of red, green, and blue. You can make a new color using the following values and the Set color HSB block:

The hue of a color is its value along the color wheel, which runs from zero to 360. Color intensity, or saturation- The range of potential values for this percentage is from 0 (no color) to 100 (maximum color). Lightness- The ideal level of brightness for a color. A numerical percentage with 0 being the darkest and 100 representing the lightest.

In this example, we'll assign a random value between 0 and 255 as the hue for one level of the pagoda's floor. You can see that the output changes color every time you run the program. We can save this shade for when the pagoda levels are being constructed, and we can add to it in a continuous cycle to move around the color wheel. 

TinkerCAD blocks

3. Booleans and Conditionals

The capacity to alter your design in response to various circumstances is one of the most interesting parts of coding. With the addition of Conditionals and Booleans to Tinkercad Codeblocks, you can make designs that are dynamic and can change their construction depending on logic. By using boolean blocks that slot into the top of conditional blocks, you may make your design respond differently.

Having looked at TinkerCAD codeblocks, it’s also important to have a look at the best alternative to TinkerCAD. There are many that are available, but we recommend using SelfCAD. SelfCAD is an easy to use 3D modeling software that has been designed for both beginners and professionals. Unlike TinkerCAD that allows you to create only simple designs, SelfCAD comes with advanced tools that allows you to create complex 3D models. 

In addition to 3D modeling tools, SelfCAD also comes with an in-built online slicer that you can use to slice your files and generate the G-code to send to send to your 3D printer. The video below shows how to slice STL files in SelfCAD.

Designing 3D Models with TinkerCAD Codeblocks

One of TinkerCAD's newest beta features is Codeblocks. Using visual programming, it enables the construction of three-dimensional creations. The definition and manipulation of variables are examples of codeblocks. Altering the values of variables makes it simple to generate designs of varying sizes.

Tinkercad is a no-cost CAD platform that runs in the cloud. Google Chrome is the browser that works best with it, but alternate browsers could also work. Aside from that, the tool is enjoyable to use, straightforward to learn, and potentially useful for makers and hobbyists.


Enjoy powerful modeling, rendering, and 3D printing tools without the steep learning curve.

Need to learn 3D modeling? Get started with interactive tutorials.

Was this blog post interesting or helpful?