Revised to Change the Ring to a BoxEnd — How to Make and Assemble Objects in Tinkercad’s Codeblocks: Divide, Simulate, Assemble (DSA)

If you are not familiar with Tinkercad’s Codeblocks see An Introduction to Tinkercad Codeblocks. Objects in Codeblocks may be considered to be parts. To illustrate this, consider designing a wrench. In an excellent tutorial, using standard Tinkercad, Dibya Chakravorty divided a wrench into three parts (a Ring, a Handle, and a Jaw).

Below, Codeblocks are used to design and simulate the parts of a wrench. Assembling the parts into a wrench is also done using Codeblocks. This has several advantages as compared to using standard Tinkercad.

  1. Codeblocks includes a simulator. You can press the Run button for an object (a part) and see if it is what you expect.
  2. Many of Codeblock’s shape objects include parameters. The value of a parameter can be easily changed.
  3. You can adjust the design of a part by using the simulator in connection with changing parameter values.
  4. Codeblocks’s simulator allows you to visualize the assembly process.

We divide the wrench into a BoxEnd, Handle and OpenEnd.

Here are the codeblocks for the boxEnd of the wrench.

Codeblocks to Create the BoxEnd.

The polygon with six sides was scaled to 0.8 in X and Y and turned into a “hole” object (by clicking on the striped-circle icon). This means it was subtracted from the cylinder with Radius of 12.5. Press the Step button and then use the spacebar to see the BoxEnd being created step-by-step.

Here are the codeblocks for the OpenEnd of the wrench.

Codeblocks to Create the OpenEnd.

Again, a “hole” shape (the polygon) is subtracted from a cylinder. From the simulation you can see that the subtraction is not done until the polygon’s modifiers (Scale, Move, and Rotate) have been executed. Press the Step button and then use the spacebar to see the OpenEnd being created step-by-step.

A polygon shape is resized by using a Scale codeblock. By changing the Scale values and the y-value of the Move codeblock, you can create a set of wrenches!

Parts can be 3D printed as prototypes. This allows real-world testing and viewing. Printing just the OpenEnd instead of the complete wrench can save time and material.

The third part needed for the wrench is a Handle. This handle is so simple that it does not need to be a separate object. Here is the codeblock that creates the handle.

Codeblock for Handle.

The assembly process involves moving the BoxEnd to the left along the x-axis and moving the OpenEnd to the right along the x-axis. The idea is to have the handle overlap a few millimeters with the BoxEnd at its left-end and with the OpenEnd on its right-end. Then Codelocks will apply the addition operation to combine the three objects into one object.

Moving the BoxEnd and OpenEnd

At the end of the codeblock statements to create the BoxEnd (see above) the following was added.

At the end of the codeblock statements to create the OpenEnd (see above) the following was added.

These statements make the handle’s left-end overlap with the BoxEnd and its right-end overlap with the OpenEnd.

Here are the codeblocks for the assembly of the wrench

Codeblocks to Assemble the Wrench.

The wrench being assembled is shown below.

Gif of Wrench Being Created.


One might expect the Move codeblocks for the Ring and Jaw to be placed after each object was added in the assembly process. I tried this but the simulator showed it did not work properly. Since Codeblocks is still in Beta, this may be changed in future versions.


You can download the .stl and .gcode files for the wrench at:

Happy dividing, simulating, and assembling.

TinyML, AI, Edge Impulse, Arduino, Raspberry Pi, Pickleball