> ## Documentation Index
> Fetch the complete documentation index at: https://stem-docs.intellectualpoint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Design project: code-blocks basket

> Use Tinkercad Codeblocks to generate a geometric basket with code - your first taste of parametric, generative design.

## Designing with code

So far you have designed by dragging shapes. Now you will design with **code**. Tinkercad **Codeblocks** lets you build models using visual programming blocks - loops, variables, and math - to create shapes that would be tedious to make by hand. This is your first taste of **parametric design**, where changing one number reshapes the whole model.

<Frame caption="Generative, geometric designs are easy to build with code">
  <img src="https://mintcdn.com/intellectualpoint/O5GrjWnEycOQFaAQ/images/intro3d/3d-modeling.png?fit=max&auto=format&n=O5GrjWnEycOQFaAQ&q=85&s=bc22a72c29f5bd17da90d4c6e13691b7" alt="A geometric 3D modeled object" width="3000" height="3000" data-path="images/intro3d/3d-modeling.png" />
</Frame>

<Info>
  Open **Codeblocks** from the Tinkercad dashboard: **Create → Codeblocks**. It works like Scratch - you snap blocks together instead of typing.
</Info>

## The idea behind the basket

A basket is just a shape **repeated in a circle**. Instead of placing dozens of walls by hand, you tell the computer: "place a wall, rotate a little, repeat." A **loop** does the repeating and a **rotation** spaces the pieces evenly around a center. Change the number of repeats and the basket gets denser; change the rotation and it twists.

<Frame caption="A loop repeats one wall piece and rotates it a little each time to form a full ring">
  <img src="https://mintcdn.com/intellectualpoint/O9vEZP6xEEMFLHva/images/intro3d/codeblocks-loop.png?fit=max&auto=format&n=O9vEZP6xEEMFLHva&q=85&s=f079c08ae97622fb3bbe45bdd3f2a109" alt="Diagram of a Codeblocks loop repeating and rotating a wall piece into a circular basket" width="1536" height="1024" data-path="images/intro3d/codeblocks-loop.png" />
</Frame>

## Build it step by step

<Steps>
  <Step title="Start a new Codeblocks design" icon="plus">
    From your dashboard choose **Create → Codeblocks**. You will see a blank canvas and a palette of blocks on the left.
  </Step>

  <Step title="Create a variable for the count" icon="variable">
    Add a **variable** called `sides` and set it to a number like `24`. This controls how many pieces make up your basket.
  </Step>

  <Step title="Add a repeat loop" icon="repeat">
    Drag a **Repeat** block and set it to repeat `sides` times. Everything inside runs once per side.
  </Step>

  <Step title="Draw one wall piece" icon="square">
    Inside the loop, add a **Box** (a thin tall wall). Give it a small width and a height for your basket wall.
  </Step>

  <Step title="Move it out from the center" icon="move">
    Move the box outward along one axis so it sits on the rim of a circle, not at the center.
  </Step>

  <Step title="Rotate a little each time" icon="rotate-3d">
    Add a **Rotate** block that turns by `360 / sides` degrees each loop. After a full loop, the pieces form a complete ring - your basket wall.
  </Step>

  <Step title="Add a base" icon="disc">
    Outside the loop, add a flat **Cylinder** at the bottom so the basket has a floor.
  </Step>

  <Step title="Run and tweak" icon="play">
    Press **Run**. Watch it build the basket piece by piece. Change `sides`, the wall height, or the radius and run again to see how the design responds.
  </Step>
</Steps>

## Why this is powerful

<Frame caption="Parametric design: change one number and the whole model regenerates">
  <img src="https://mintcdn.com/intellectualpoint/O9vEZP6xEEMFLHva/images/intro3d/parametric-design.png?fit=max&auto=format&n=O9vEZP6xEEMFLHva&q=85&s=6b2246c755b0072f267a24ace614baaa" alt="Diagram showing how changing a single parameter reshapes an entire parametric model" width="1536" height="1024" data-path="images/intro3d/parametric-design.png" />
</Frame>

<CardGroup cols={2}>
  <Card title="Change one number" icon="sliders-horizontal">
    Adjust `sides` from 12 to 48 and the whole basket regenerates. That is parametric design.
  </Card>

  <Card title="Loops do the boring work" icon="repeat">
    The computer repeats perfectly what would take you forever to place by hand.
  </Card>

  <Card title="Math makes patterns" icon="calculator">
    `360 / sides` guarantees the pieces are always evenly spaced, no matter the count.
  </Card>

  <Card title="Export like any model" icon="download">
    Codeblocks designs export to `.stl` and print exactly like drag-and-drop designs.
  </Card>
</CardGroup>

## Slice and print

Export your basket to STL, open it in Cura, and slice with beginner settings. Because a basket has thin walls and open sides, consider:

* **A brim** for extra first-layer grip
* **Slower speed** for clean thin walls
* **Vase mode** (optional) for a single continuous spiral wall

<Tip>
  Codeblocks is a bridge between design and programming. If you enjoy it, the same ideas - variables, loops, and math - power professional CAD tools like OpenSCAD and Fusion 360.
</Tip>

<Check>
  You built a basket with code, changed a variable to reshape it, and exported it to print. You just did generative design!
</Check>
