Tinkercad's new Codeblocks computational design workspace is the simplest place to make 3D models using draggable blocks of code.
Learn basic design and coding principles in an easy-to-learn workspace using Scratchblocks 3.0 as seen in MIT's Scratch application.
Let's get started!
Step 1: Sign in to Tinkercad
Codeblocks is a new workspace for Tinkercad and is still in development, but you can enter it in the same way as the 3D and Circuits workspaces.
- Go to Tinkercad.com
- Sign in to your account (or create one if this your first visit)
- Once you are signed in, you will land in the User Dashboard.
- If you have never worked 3D model or in Tinkercad before, it might be worth taking our Starter lessons in our 3D Workspace. Click here to start Lesson 1: Place it!
Step 2: Create a New Design in the Mini-dashboard
This area is where you come to find existing Codeblocks Designs, create New Designs or open Starters Designs.
Let's create a New Design to introduce you to the workspace.
- Click the 'New Design' button in the top right corner.
This will close the Mini-dashboard and open the Code workspace.
(Note: At the top, you can see a variety of fun Starter Designs. These sample designs show different ways of using code to assemble Shapes. Once you finish the Quick Start lessons drop back here and have a look at them.)
- Continue to the next step to see an overview of the workspace.
Step 3: Viewing the Workspace
When you drop into the workspace, you can see it is very similar to Tinkercad's 3D editor workspace, but broken up into several sections.
Navigation (Nav) Bar- Macro controls that are used across all Tinkercad workspaces.
Tool Bar- View, Name, Edit and Export your Design.
Blocks Panel- Scroll to view a variety of Codeblock options.
Blocks Editor- Stack your Codeblocks here to define and refine your Design.
3D Viewer- See the results of what you built in the Block Editor.
Now that we know the layout, let's begin building!
Step 4: Designing With Code- the Process
Design is a process of making creative decisions to create something and then refining those decisions until you, as the creator, determines the project is complete.
The same thing is true for coding, it is a process where you make decisions, using commands, until you have achieved the outcome that you are looking for.
In Codeblocks, there is a repeating rhythm to this process. Let's take a look at the steps-
1. Select- You start by Selecting a Codeblock, preferably a Shape Block, like the Box from the Block Panel on the far left side.
2. Stack- Click and drag it from the Block Panel into the middle of the Block Workspace, as shown above. This is where you Stack the blocks to create a script.
3.Run- Once you have placed the Shape, you look to the upper right hand corner for the Run Button and click it.
4. Review- Below the Run button is the 3D Viewer where you view your work or Review any changes you have made to your design. In the 3D viewer, you should see a 3D version of the Shape that you selected in Step 1.
5. Adjust- From here, you would go back to the Block workspace and Adjust your Design by dragging in another block or making changes to the Shape that you have already selected.
As mentioned, you will continue this process - Select, Stack, Run, Review, Adjust - until your design is finished.
Now that you have a feel for the process, let's take a closer look at the most common features of the Codeblocks Workspace.
Step 5: Stack It!
To design things in Codeblocks, you snap blocks of code together to form a Stack of sequential commands or actions. These actions control the Shapes and the result is a 3D Design that you can view in the 3D Viewer.
Let's start by dragging in the 'Box' Shape block.
- Locate the Block Panel, on the left side of the workspace. This is a list of all the blocks available.
- Click and hold on the red Box block and drag it from the Block panel into the middle area, called the Block Editor.
(Note: To work properly, there must always be at least one Shape in your stack.)
- Click Next to learn how to Run the code and see the Box in the 3D Viewer.
Step 6: Run It!
Since we are using code to create our design, we need to Run that code see your result in the 3D Viewer. This is an important process and one that you will repeat over-and-over as you update your design.
- Locate the Run button in the top right corner of the Workspace. This area is called the ToolBar.
- Press the Run button
- Watch your Box Shape load in the 3D Viewer
- Click Run again to see your Shape reload. Now you are coding!
(Note: See how your Box has loaded in the very center of the grid and is 1/2 above and 1/2 below the Workplane? This is normal and slightly different than Tinkercad's regular 3D workspace, where Shapes load on top of the Workplane.)
- Continue to the next step to see how to control the view of your Shape in the 3D Viewer.
Step 7: View It!
Now you have seen your 3d Shape load in the 3D Viewer, let's look at how to view it from a variety of angles.
There are 2 main ways to control the camera in the 3D Viewer-
- Move using the in-screen controls-
The ViewCube is like a mini controller for the screen. It has labels of the various view angles (front, top, etc.) that match the workspace. 'Grab' it by clicking your mouse on it and dragging to rotate.
For quick view changes, you can click the various labels or fields. Hover your cursor or finger over top of the ViewCube and you can see the fields highlight. Click any of the fields to see your model from that angle.
To Zoom in and out, click the '+' and '-' Zoom buttons
- Move using your mouse (or touch gestures). There are 3 different control points-
Orbit- Used to rotate around the model. To Orbit, hold own the Control key, while dragging your mouse anywhere within the Viewer area. For touch controls, drag one finger anywhere outside your design.
Pan- Used to move sideways or up and down to center your model in the Viewer. To Pan, press and hold the 'Shift' and 'Control' key while using the mouse to click and drag anywhere within the View area. For touch control, use two fingers and drag anywhere outside your design.
Zoom- Zoom in and out to view small details. To Zoom, use the scroll wheel on your mouse. For touch, use two fingers to pinch or pull on your trackpad or touch screen.
- Continue to the next step and let's make some changes to its Shape.
Step 8: Shape It!
Most Shapes have onboard controls that let you modify the Shape to fit your needs.
- Locate the arrow icon on the right side of the Box Shape block.
- Click the arrow to open the drawer. You will see a list of controls with number fields. These numeric controls are called Parameters. They control certain attributes of the Box Shape, like Width (W), Length (L) and Height (H). Let's change the Width.
- Click into the white Field area next to the W (for Width). This will highlight the 20.
- Type 40 in the field.
- Now press Run and review your Shape. Does your Box look more rectangular now? That's good. If not, maybe check the field to be sure your number was input correctly.
- Experiment- Now that you've seen how to modify your Shape, feel free to try some of the other controls to see how they effect the Shape!
- When you are ready, let's move your shape around the Workspace.
Step 9: Move It!
To move Shapes in the workspace, you use the Move block. It works like taking steps along a path starting at the Shape's current location on the grid, which for your Box is 0.
- Locate the Move block in the Block Panel by scrolling down to the Modify category.
- Click and hold on the Move block and drag it into the Block Editor.
- Hover the Move block toward the bottom of the Box block and you will see a shadow appear. If you let go, the Move block will snap onto the Box block.
Important tip: All non-Shape blocks require a Shape to do their action. Many blocks take action on only the nearest Shape above them. If there is only one Shape in the workspace, attaching the Move block on top of a Shape won't effect an action on that Shape.
- Now that the Move block is below the Box block, we can use it to move the Box in the 3D Viewer. Like before, let's click into the 'X' Field where we see a 0 and type 50. This will move the Box far enough that you will see the difference.
- Now, click Run and notice how far the Box moves. It has moved 50 mm along the X axis.
(Note: You can see which direction the X axis runs by looking at the Red line near the center of the Workspace. You can also see the direction of the Y axis in Green and the Z axis, that runs up and down, in Blue.)
- Experiment- What if you want the Box to move along the same path (axis), but in the opposite direction? Use math! Like a number graph, if we started at 0 and wanted to move to 50. We move by 1 until we get to 50. The opposite direction on the graph would start at 0 and move using negative numbers, so 50 steps in the opposite direction is -50. Enter -50 in the 'X' field and press Run. Did it Move in the opposite direction?
- Lastly, play around with the numbers in the other axes (Y and Z).
- When you are ready to move on, click Next and we'll do some spinning.
Step 10: Rotate It!
You can attach the Rotate block to your stack to add a rotation movement.
At this point, your stack should have a Box block with a Move block snapped to it.
- Locate the Rotate block in the Block Panel. You can also find it in the Modify category.
- Click and hold to drag the Rotate block into the Block Editor and hover at the bottom of the stack until you see the shadow. This lets you know that it is close enough to snap onto the stack. Release your block.
- Click the 'Axis' field to see a dropdown of the 3 axes we learned in Move it!. Select an axis and click return.
- Click into the 'Degrees' field. Change it from 90 to 45.
- Now press the Run button to see your Box rotate.
- Experiment- Now that you see how it works, play around with the fields to see how the controls work. Also, try dragging the Rotate block to a different area of the script, like just below the Box block. Notice how the sequence of actions has changed.
- Now try to drag another Rotate block into the Stack to add multiple Rotation actions.
- Continue to the next step.
Step 11: Color It!
Color adds a new dimension to the look of your models and its easy to change.
- Find the Shape block for the Shape you'd like to change the color of.
- Click the colored circle on the Shape block. This will open the Color Menu.
- Click on the color swatch you would like.
- Click anywhere outside the Color Menu to close it.
- You've learned enough of the basics, now we can bring them all together to make a model.
Step 12: Aligning Shapes to Make Something
Since every Shape loads at the origin point at the center of the workspace, it's pretty easy to align Shapes, by stacking them on top of one another. Let's make a quick rocket to show how.
If you have any blocks in your Block Editor, drag them all to the Trash icon in the bottom right corner.
- Drag three Shapes into the Block Editor - a Cone, a Cylinder, and a Star (the Yellow one). Press Run to review your work.
- We want all of these Shapes to stack from top-to-bottom, but let's adjust the size of them first. Click the Arrow to open the control drawer for the Cylinder and increase the 'H' (Height) field from 20 to 40.
- Click the Arrow to open the drawer of the Star and set the 'Radius' field to 17. Press Run to review your work.
- Notice how all your Shapes are floating in the center? Let's move them to assemble our Rocket. Drag in a Move block for the Cone and insert it into the Stack just below the Cone Block. Now repeat for the Cylinder and the Star.
- Let's move the Cylinder so it sits on top of the Workplane. We use the 'Z' axis to move up and down. Since the Cylinder is half above the Workplane and half above, we should be able to calculate half the total height to move it to the top of the Workplane. In the 'Z' field on the Cylinder's Move block, input 20. Run to check your work.
- Is your Cylinder sitting on top of the Workplane? If so, let's move the Cone Shape to the top of the Cylinder. Try to calculate how far to move it. Enter it into the Cone's Move block and hit Run to check your work. Its okay if it takes a couple tries to get it right.
- Once you have the Cone Shape sitting on top of the Cylinder, let's move the Star Shape up to sit on the Workplane. Calculate and input the number into the 'Z' field of the Move block attached to the Star Shape and press 'Run' to check your work.
- How does your Rocket look? Maybe your Star Shape looks a bit out of alignment? Sometimes, to align Shape with an odd number of sides, its best to make it an even number. Let's reset the number of sides on the Star to 6 to make sure all the parts are aligned correctly.
- Does your design look like a Rocket? Congratulations! By using a combination of Move and Rotate blocks, you can assemble Shapes into all kinds of amazing objects.
- Experiment- Now that you have a finished Design, what would you do to change it? Can you see areas to play with the Shape of the pieces? How does changing the color change the Design? Share your work with a classmate or friend.
- Before we move on to another Design, let's save this one and open a New Design.
Step 13: Save It!
This step is sort of a trick since Tinkercad automatically Saves your Designs while you work, but its important to know when a Design might be finished and when to start a new one.
- To prepare your Design for closing, click the Name field on the top right, in the Toolbar. It probably has some sort of funny placeholder name. Click on the letters to select them.
- Type a new name for your Rocket Design and click Return on your keyboard.
- Now, click the 'Codeblocks' button to the left of the Name Field. This is how you open the Mini-dashboard.
- Click the 'New Design' button in the top right corner. This will Save your last Design in its current state and Open a New and Empty Design.
- Now let's see how to combine your Shapes to move and modify portions of your design.
Step 14: Group It!
Grouping is one of the most important actions in Tinkercad because it allows you combine parts of your design for easy movement or modification. This will also help prepare them for 3d printing.
- Drag a Box and Cylinder into the Block Editor.
- Attach the Cylinder to the Box block.
- Click the arrow to open the Control drawer. Click into the Radius field and change the number to 6. Click into the 'H' (Height) field and change it 30.
- Drag a Create Group block into the Block Editor and attach it to the bottom of the Stack.
- Drag a Move block and attach it to the bottom of your Stack below the Create Group block and change the X and Y fields to '10'. Click the 'Run' button to review your model. The grouped parts should now move as a single part.
- Exploration- Insert a Move or Rotate block above the Create Group block to see what happens to your Design. Try adding a Shape after the Create Group block and try to Move or Rotate it.
- Let's see how to cut a Hole in a Shape using the Group block.
Step 15: Cut a Hole in It!
A Hole is a Shape that has been changed to cut into another Shape. It is activated when you use a Group block to combine regular Shapes and Holes.
- Clear your Block Editor by dragging all your blocks into the Trash.
- Drag a Box and Cylinder into the Block Editor. Snap the Cylinder to the bottom of the Box block.
- On the Box block, click the Arrow to open the Control drawer. Reduce the Height of the Box, by clicking into the 'H' (Height) field. Change the number to 10.
- On the Cylinder block, next to the Color field, is the Hole field. When you click this, it deselects the Color field turning the Shape into a Hole.
- Click 'Run' to view your Shapes. Notice that your Box is still a Solid color and the Cylinder is now transparent. See where the Box and Cylinder meet? This shows where the Hole will be cut into your Box Shape
- Drag a 'Create Group' block into the Block Editor and attach it to the bottom of the Stack. Click 'Run' to update your 3D View. You can see that the 'Create Group' has combined the Shape and Hole, leaving a Cylinder-shaped Hole in the solid Box.
- Exploration- What happens when you move the Cylinder around toward the edges of the Box using the Move block? What happens when you Move the Cylinder completely outside the edges of the Box Shape?
- Continue to the next step.
Step 16: Print It!
If you have access to a 3D printer, you can export your Design as an .stl file for printing.
- Find and click the Export button in the Toolbar.
- In the menu, click the .STL button (or .OBJ if you are printing to a multi-color printer).
- Look in the Downloads folder of your Computer for the name of your Design.
- Use your printer software to prepare your file for print.
- Load the file to the printer and press Start!
- Continue to the next step
Step 17: Make a GIF Animation!
It's fun to watch your Codeblocks Designs auto-build as an animation. You can share animations of your Design building using the .GIF creation tool.
- Find and click the Share button in the Toolbar.
- Position Your Design in the 3D Viewer using the same tools (Orbit, Pan and Zoom) that you learned in the 'View it!' section.
- Click 'Animated GIF' to start the Design build sequence.
- If you want to get fancy, use the 3D Viewer tools to Orbit around your model while it records to feature specific parts of the build sequence.
- Once the Design finishes building, the tool assembles the images into a full animation. This may take a couple of minutes if the design is complex. When complete, a .GIF file with your Design's name will be dropped into your Downloads folder.
- Once finished, close the window using the Close button and return to the Codeblocks workspace.
- View your .GIF by dragging it into a browser tab or email to friends and family.
- Continue to the next step.
Step 18: Make a Part for Reuse!
The PartMaker tool will turn your design into a single, combined part and send it to your Parts Collection in Tinkercad's 3D workspace for adding to other Designs.
- Finalize your Codeblocks Design.
- Find and Click the Export button in the Toolbar.
- Click the Part button in the menu.
- In the Part publishing dialog, add information about your Part, like Name, Description, and Tags.
- Click the 'Save Part' button and the workspace will close and return you to the Codeblocks Workspace.
- To leave the Codeblocks Workspace and use your Part in the 3D workspace, click the Tinkercad Icon in the top left corner.
- In the User Dashboard, click 'Tinker This' button on an existing Design or click the 'Create New Design' button to open a Design.
- Once in the 3D Workspace, look to the Shape Panel on the right side and click the 'Basic Shapes' button.
- In the dropdown menu, look down near the bottom and click the 'Part Collection' button.
- Your new Part should appear at the top of the Part Collection.
- Drag your new Part into the 3D Workspace and start designing!
(Note: Making and using Parts can save you a lot of time and effort on your design, especially with things that you do over-and-over. What other kind of things would you make and use in the 3D editor?)
- Continue to the next step
Step 19: Now You Know the Basics, Go Design Something!
We've covered the basic functions of the Codeblocks workspace. This should give you the perfect launch point for exploring the rest of the blocks and workspace features.
To learn more about Codeblocks, give us feedback, or suggest new features, drop by our Codeblocks Community Forum and take a look around. It's a great place to meet other Codeblocks users, share your work, and find solutions to the parts of the app that don't quite make sense.