Tinkercad recently announced a new feature called Codeblocks. While still in beta, this feature allows 3D designers to use code blocks (powered by Scratch) to create models that they can share, export and even place into their Parts Collection.
While coding in 3D design for the average user isn’t new, see OpenSCAD and BeetleBlocks as examples, having access to the coding environment in Tinkercad is tremendously beneficial for the many schools already using this tool with students of all ages.
You access Codeblocks (BETA) by selecting it on the menu at the left when first launching Tinkercad. It will open a new page with the coding environment and the Tinkercad workplane side by side. As of this writing, there is a smaller prompt window asking you to select a sample model or create a new one. I suspect the developers will remove this prompt window in future versions.
If you open a sample, you can see the existing code and “Run” it to check how it renders on the Tinkercad workplane. If you create a new design, you get a blank slate, ready for coding.
Anyone used to Scratch is going to find this easy to get up and running. Drag blocks from the left into your script area, connect them, set parameters like size and movement, create variables and more. Click on “Run” at the top-right of the screen to see your code render on the workplane.
When you are you ready to bring this model into the regular Tinkercad interface, you can use the Export feature. Currently, you can export as .STL or .OBJ, or even better, you can add it to your Parts Collection to drag into another project. I recently wrote about the Parts Collection feature in this blog post about 3D printed LED Caps.
The sample projects that Tinkercad provides are helpful for dissection and serve as springboards for your own projects. I suspect that just as there is a gallery of shared models now, there will soon be a gallery that allows users to share code.
Why is This Good?
While there is much to be read about the importance of coding, I think Mitch Resnick said it best in his TED talk about coding with Scratch.
As kids are creating projects like this, they’re learning to code, but even more importantly, they’re coding to learn. Because as they learn to code, it enables them to learn many other things, opens up many new opportunities for learning.
He goes on to make an analogy with reading and writing. As we learn to read and write, these new skills help us to learn more. The same goes for coding. It’s not just about becoming a computer programmer, which is terrific in its own right, but coding is another tool in life to help us think, imagine and create.
There is another reason that coding with 3D design is particularly useful. Often, in Tinkercad, there are objects that students might imagine in their heads but are unable to execute on the screen with the existing tools. Having the ability to write code allows these young designers an opportunity to create differently than they otherwise would. It enables them to test out their designs, make subtle adjustments, and test again. The model I created in the image at the top of this page would have been very challenging without the ability to write code.
What I Hope to See in the Next Version
Codeblocks (BETA) is a terrific start for using block-based coding with Tinkercad, and it’s only going to get better. Here are some features and modifications I would love to see in future versions.
Exporting code: While you can currently share the finished model with others via .STL and .OBJ file types, you can’t share the code itself. In the spirit of the Scratch community and the value of sharing our work, I hope this comes soon. I can imagine my students writing new code that they could then share with their friends to test out, modify and make their own.
Backpack: In Scratch 2.0, users all have backpacks. This feature allows any user to grab code from different projects for inclusion in their own project, again in the spirit of sharing your knowledge. I noticed that the Scratch 3.0 beta doesn’t have the backpack yet either, so it may just be a matter of time.
Executing just part of the code: In Scratch, you can execute a single block or series of blocks by double-clicking on the top block. This action allows you to see what that particular slice of code is doing, and you can make adjustments as needed just in that small portion of code. I do not see a way to do that here. For example, if my project involves three separate objects, I’d like to generate just object #3 to see what it looks like without rendering objects #1 or #2. This is not possible to do in the current version.
Duplicating code: The ability to duplicate pieces of code is essential for rapid development and testing. In Scratch, you can right-click or CTRL+click any segment of code to duplicate it and place elsewhere in your script.
Overall, I am very impressed with the implementation of Tinkercad Codeblocks (BETA) and look forward to testing this out with my students. While I eagerly await new versions with expanded features, there is enough here to get started now.