Skip to content

Mesmerizing Hex Fidget

You will print a toy that comes off the printer already moving: nested hexagon rings that spin and rock inside each other, no assembly required.

The finished hex fidget: four nested hexagon rings around a solid center.


Overview

Until now, everything you've printed has been one solid piece. This toy is five pieces — four rings and a center — and you'll print them already assembled, moving parts and all. That trick is called print-in-place, and the whole secret is a small gap between the pieces so the printer can't weld them together.

To build it, you'll teach Codeblocks a new trick too: a template. A ring is nine blocks, and the toy needs several of them. Instead of placing those nine blocks over and over, you'll write the recipe for a ring once, give it a name, and then ask for a ring whenever you want one. The finished program that draws this whole toy is only four blocks long.

Builds on: sk8board Time! — variables, math blocks, holes, grouping, loops, and exporting to .STL.

You've got it when…

  • You defined a Ring template and a Center template — each a named recipe you wrote once.
  • Pressing Play draws nested rings around a solid center, built by Create from Template blocks inside a Repeat loop, not by copies you placed by hand.
  • An if/then block decides when the rings stop.
  • You customized at least one variable, on purpose, within its range.
  • Your .STL file is submitted in Google Classroom.

Collaboration & AI

Work: On your own. Ask a neighbor for a hand if you're stuck, but build your own fidget.

AI — AIAS Level 1, No AI: Templates are the new idea in this lab — meet them yourself. What the levels mean.


Create the Project

  1. Go to Tinkercad, sign in, click Create, then Codeblocks.

  2. Click the random name at the top of the screen and rename your project Hex Fidget.


Variables

Four variables control this whole toy. You'll set them once now, and near the end of the lab you'll come back and turn these knobs to make your fidget yours.

  1. Create four number variables (Variables ▸ Create number variable…): height, number sides, diameter, and tightness.

  2. Add four Set blocks and set the values shown.

    Four Set blocks: height 4, number sides 6, diameter 60, tightness 6.

    Note

    Nothing draws yet — variables only store numbers. What each one does, and how far you can push it, is coming in the Make It Yours section.


What's a Template?

A template is a recipe you write once and reuse. You've seen the idea off the screen: a cookie cutter is a template. You make the cutter one time, then stamp out as many cookies as you want — and if you change the cutter, every cookie you stamp from then on changes too.

In Codeblocks a template has two halves, and they live under the new Templates category:

  • Define Template is where you write the recipe. You give it a name and fill it with the blocks that do the work. Defining a template draws nothing — writing a recipe card isn't the same as cooking dinner.

  • Create from Template a Create from Template block is where you use the recipe. One of these blocks says "make one of those now," and the shape finally appears.

You'll write two recipes — one for a ring, one for the center — and then a short program that calls them.

Where templates come from

Click Templates in the block drawer, then Create Template, to start a new one. Each template you define shows up in that same drawer as its own Create from Template block, ready to use.


The Ring Template

A ring starts life as a cone with its top cut off — wider at the bottom than the top. That slant is the secret to the whole toy. You'll build the whole ring recipe inside a Define Template so you can stamp out rings later.

  1. Make a new template (Templates ▸ Create Template) and name it Ring. Everything in the next steps goes inside this Define Template Ring block.

  2. Drop a Comment block in first: This template builds a single ring. A comment is a note to yourself; the program ignores it.

  3. Add a Cone and unfold its parameters. Set Sides to the number sides variable and H to height. Set Bottom Radius to the equation diameter / 2, and Top Radius to diameter / 2 - tightness.

    Order of operations, again

    Same rule as the sk8board's wheelbase equation: divide first, then subtract — the division block sits inside the subtraction block. Built the other way, 2 - tightness is negative, and your cone turns inside out.

  4. Add a Move block set to Z-axis min to 0.0, resting the cone on the Workplane.

    The Add Cone block with Sides, Top Radius, Bottom Radius, and H set, above a Move block.

  5. Right-click your Add Cone block and choose Duplicate — the whole block copies, equations and all. Snap the copy under the Move block. On the copy: click the striped circle to make it a hole, change its Top Radius equation to diameter / 2 - tightness + 2, and its Bottom Radius to diameter / 2 - 2. Add a Move block set to Z-axis min to 0.0 under it (unless Duplicate already brought one along).

    The duplicated hole cone with its adjusted equations.

    Those 2s are the whole trick

    The hole cone is 2 millimeters smaller than the next ring that will grow inside this one. That 2 mm of air is called clearance — a gap big enough that the printer can't fuse the pieces, small enough that the rings can't escape each other. Print-in-place lives or dies on it.

  6. Add a Group Selection block. It combines the shapes above it — the hole does its cutting now. Then mirror the ring so an inner ring can't slide out the top: add a Copy, a Rotate around Axis y by 180 degrees from Pivot 0, 0, 0, and a second Group Selection to fuse the ring to its mirror image.

    The Copy, Rotate around Axis y by 180, and Group Selection blocks.

  7. Add one last block to the recipe: a Change block from Variables — Change diameter by -8. This shrinks diameter by 8 millimeters, so the next ring you stamp comes out smaller than this one.

    The Change diameter by -8 block at the bottom of the template.

    Your finished Ring template should look like this.

    The complete Define Template Ring: comment, two cones with moves, group, copy, rotate, group, and Change diameter by -8.

    Press Play — nothing happens. That's right.

    A Define Template is a recipe card, not a meal. Pressing Play now draws nothing, because you've only written the recipe — you haven't asked for a ring yet. That comes in two more steps.


The Center Template

The bullseye of the toy is a solid piece — a ring without the hole. It's the same recipe, shorter, so this one goes fast.

  1. Make a second template (Templates ▸ Create Template) and name it Center. Inside it: a Comment (This template creates the center), a Cone with the same four parameter equations as before (Duplicate is your friend), a Move to Z-axis min to 0.0, a Group Selection, then the mirror — Copy, Rotate around Axis y by 180 from Pivot 0, 0, 0, and a final Group Selection.

    The complete Define Template Center: comment, cone, move, group, copy, rotate, group.

    No hole, no Change

    The center is solid, so there's no hole cone. And nothing comes after it, so there's no Change diameter — the center is made once, at whatever diameter is left when the rings are done.


The Program

Two recipes written. Now write the short program that uses them. This part is a separate stack — start it in an empty part of the workspace, below your Set blocks.

  1. From Templates, drag a Create from Template Center block into the empty workspace.

    Click Play. Your screen should look like this.

    A single solid hexagon center piece on the Workplane.

    Your first template, used

    One block, one shape. That's a template working: the recipe you wrote under Define Template Center ran because a Create from Template asked it to. Defining drew nothing; creating drew the center.

  2. Now the rings. Drag a Repeat block from Control above your Create from Template Center, and set it to Repeat 10 Times. Drag an if/then block from Control into the Repeat block's mouth.

  3. Build the condition diameter > 28 in the if block's slot: drag the comparison block from Math into the slot, change its = to >, drag the round diameter variable into the left space, and type 28 in the right.

    The if block holding the condition diameter > 28.

  4. Drag a Create from Template Ring block into the if block's mouth.

    The finished program: Set blocks, then Repeat 10 holding if diameter > 28 then Create from Template Ring, then Create from Template Center.

    Click Play. Your screen should look like this.

    The finished fidget: four nested hexagon rings around a solid center.

Checkpoint

Look how short the program is: a loop, a question, and two Create from Template blocks. All the real work lives in the two recipes you wrote once. That's what templates buy you.

Where did the other trips go?

The loop offers 10 trips, but you got four rings. Each time Create from Template Ring runs, its last block counts diameter down by 8: 60, 52, 44, 36… The if/then only says yes while diameter is above 28, so once it drops to 28 the remaining trips build nothing. The loop counts; the conditional decides. Change diameter later and the same four blocks make more rings or fewer.


Make It Yours

Here's what each variable does, and how far it bends before it breaks. Change one at a time, predict what you'll see, then press Play and check yourself.

Variable What it does Range
height Thickness of the toy in millimeters. Thin prints fast and flexes; thick feels chunky in the hand. 3 – 8
number sides How many flat sides each ring has. 6 is the hex in hex fidget; 3 is a triangle; past about 24 it looks round. 3 – 64
diameter How wide the whole toy is, in millimeters — and, through the if block, how many rings it has. 40 – 200
tightness How steep the ring walls slant. Lower numbers are looser — the rings rock farther and feel floppier. Higher numbers are tighter and shorter-travel. 3 – 12
  1. Set number sides to 24. Predict first, then Play.

    Your screen should look like this.

    The fidget with 24-sided rings, nearly round.

  2. Set number sides back to 6, then set diameter to 100. Predict: wider, sure — but how many rings now? Play.

    Your screen should look like this.

    The fidget at 100 millimeters wide, with many more rings than before.

    About the colors

    Tinkercad picks each shape's color for you, so your fidget may not match the pictures. Shapes share one color each time a Group Selection combines them. Shape and position are what to check, not color.

  3. Set every variable to the combination you actually want to print — anything you like, inside the ranges. Stay near 60 for diameter unless you want to wait on a very long print.

Outside the ranges

The ranges aren't decoration. Below 40, diameter leaves no room for even one ring; a tightness below 3 can drop the clearance to nothing and print as one welded lump. If your Play result looks wrong, check the table before you blame the blocks.


Preparing for 3D Printing

We need to export the design in a format the 3D printing software can use.

  1. Click the Share button the Share button in the upper right corner.

  2. Select .STL

    The export dialog with the .STL option.

  3. Submit your downloaded .STL file in Google Classroom.


Go Further: Claim the Center

The center of your fidget is a solid hexagon about 20 millimeters across — a blank billboard. Put your initials on it, or a simple logo built from shapes.

Here's the template payoff: these blocks go inside your Center template, after its last Group Selection. Change the recipe once, and the center that comes out of it changes — you don't touch the program at all.

  • Add a Text shape from Shapes. Unfold it and replace TEXT with your initials — two or three letters fit best.
  • Add a Set size block: X 16, Y 8, Z 2 fits the center at the default diameter.
  • Add a Move block set to Z-axis min to 4 — your height value — so the letters sit on the center's top face.

Click Play. The letters rise from the center of the toy. That's the raised finish. For engraved letters instead, click the Text block's hole button and add one more Group Selection at the end of the template — the letters get carved into the face.

A logo works the same way: build it from basic shapes, size it to the center, raise it or sink it. One rule either way — keep your letters or logo on the center piece only. Anything hanging past the center's edge will weld your rings together, and a fidget that doesn't fidget is a coaster.


Turn It In

  • Your hex fidget's .STL file, submitted in Google Classroom.

Credit: Adapted from Print-in-Place Mesmerizing Hex Fidget Toy.


How It's Graded

This lab is worth up to 4 points. One score covers everything you turn in.

Score What it looks like
4 — Excellent Pressing Play draws the nested rings from a Create from Template Ring inside the Repeat loop, the if/then stops them at the right size, the center comes from a Create from Template Center — and your variables are deliberately set inside the documented ranges, so the toy you exported is one you designed, not just the defaults. The .STL is in Google Classroom.
3 — Above Average A complete, printable fidget with a slip — the defaults untouched, a value just outside its range, or the Change block's -8 typed as a positive number and corrected at the desk.
2 — Average A real gap — rings placed as hand-made copies instead of a template in the loop, the if/then missing so tiny rings pile up in the center, or no center piece.
1 — Below Average A template or a single shape, but the program never produced a fidget; or nothing exported.
0 — Failing Nothing submitted and no design in your account.