Home β€Ί Module 1
πŸ”₯ Module 01 Β· Advanced

Parametric Design

✨ PAN'S RULE: If it's not chaotic, it's not magic! ✨

Write code to generate 3D models using OpenSCAD. Change one variable and the whole design adapts.

Imagine building a LEGO house. To make it taller, you have to take the roof off and add more bricks one by one. Tedious! 🧱

🧱
Normal Way
➑️
✨
Parametric Way

What if you had a magic spell to just say "House, grow taller!" and it did? That's what parametric design is! You create rules (we call them "parameters"), and the computer rebuilds the object for you instantly. Let's learn the spells! πŸ§™

πŸ›‘οΈ Safety Check: Real-world 3D printers use a super-hot nozzle (hotter than an oven! πŸ”₯) to melt plastic. Never touch the metal tip or moving parts while it's running. It's also a good idea to print in a room with good airflow (like an open window). Always ask a parent to be there when you operate the real machine. For today, we're just writing code in our safe, digital sandbox!
πŸ’»

Coding 3D Models with OpenSCAD

OpenSCAD is a free tool that lets you design 3D models with code. If you want to change the size of a custom box, you don't use a drag-and-drop toolβ€”you just change a variable like width = 50; and re-run the code! Think of cube() as your magic LEGO brick. Instead of snapping blocks together, you're telling the computer the size of the brick you want.

πŸ“Ί Teaching Tech β€” "OpenSCAD for 3D Printing" β€” A great intro to how code loops and variables can build amazing things.

πŸ•΅οΈ Knowledge Check

Look at this code: cube([30, 15, 10]); This makes a rectangular block. Which number would you change to make the block WIDER (the first value)?

30
15
10
πŸ’» Mission: The Magic Subtraction

The Magic Carver: Adding & Subtracting Shapes

CSG is a fancy term for adding and subtracting shapes. In the code below, we're using the difference() function to magically subtract a cylinder from the center of a cube. Hit the button to see what happens!

Compiler Output:

πŸ§™ Behind the Magic: The Three Spells of CSG

You just used `difference()`, which is one of three 'magic spells' in Constructive Solid Geometry (CSG). It sounds complicated, but it's just like playing with digital clay! These are the words real engineers use:

  • Union(): Glues two shapes together into one.
  • Difference(): Carves one shape out of another (your carving spell!).
  • Intersection(): Keeps ONLY the parts where two shapes overlap.
πŸš€ Project: Design a Custom Name Tag

Make Something That's Uniquely YOURS!

Let's make something you can show off: a custom name tag for your backpack. This is way cooler than a boring cable holder and the perfect first project!

Step 1: Create the Base

First, we need a solid block of digital material. This code makes a flat rectangle. The numbers are [width, depth, height]. Try changing them to see how the shape changes!

Step 2: Carve Your Name!

Now for the fun part! We'll use our difference() spell again, but this time with the text() command. The code below carves the word "Pan" into the tag. Change "Pan" to YOUR name and hit 'Carve It!' to make it your own!

πŸ€– The Clone Machine!

Making one thing is cool. Making 100 is power. A for loop is a classic coding tool that repeats an action. It's like having a robot army to build for you!

Beginner Mission: Make a Fence

This code makes one lonely fence post. Can you wrap it in a for loop to create a line of 5 posts? Hint: for (i = [0:4]) { ... } and use translate([i * 10, 0, 0]) inside!

πŸš€ Level Up: Build Your Own LEGO Block with `module`

Real programmers hate copy-pasting code. It's messy! Instead, they package useful code into reusable blocks called modules. It's like creating your very own custom LEGO brick that you can use over and over.

You can turn your Name Tag code into a module that lets you create a tag of any size with any name, just by calling one command! This is a super powerful concept that bridges the gap to real engineering.

// 1. Define your own special command (module)
module name_tag(tag_width, tag_depth, your_name) {
    difference() {
        cube([tag_width, tag_depth, 5]);
        translate([5, 8, 1]) 
            text(your_name, size=20, font="Liberation Sans");
    }
}

// 2. Now you can use it as many times as you want!
name_tag(80, 40, "Pan");
translate([0, 50, 0]) name_tag(100, 30, "Agent");
πŸ’» Interactive Mission

The AI Sandbox

Ready for a classic challenge? Try to build a spiral staircase. You'll need a `for` loop that uses `translate()` to move up AND `rotate()` to twist at each step. Here's a hint: `rotate([0, 0, i * 36])`. Go for it! πŸŒ€

System Output:

✨ The Next Frontier: AI Dream-to-Object

Coding shapes is powerful, but what if you could just... ask for a shape? That's the next adventure! Tools like Spline AI let you type a sentence like "a friendly robot dragon holding a pizza" and an AI will generate a 3D model for you! The coolest part? You can often export these AI-generated models and import them into OpenSCAD to add your own parametric features, like custom holes or connectors. It's the perfect blend of AI creativity and your engineering control.

πŸ›‘οΈ AI Safety Check

  • Be an Artist, Not a Client: Use AI as a starting point. It's a tool to help your creativity, not replace it!
  • No Personal Info: Never type your full name, address, or school into an AI generator. Keep your private information private.
  • Talk About It: If an AI makes something that seems weird or makes you uncomfortable, tell a parent or trusted adult right away.

πŸ‘¨β€πŸ‘©β€πŸ‘§ For Parents: AI tools like this are amazing for creativity but often require an account. This is a perfect "explore together" activity. You can co-pilot the sign-up and be amazed at what your child dreams up!

πŸ‘¨β€πŸ‘©β€πŸ‘§ Parent Corner: From Code to Creation

Curious how this code becomes a real object? OpenSCAD is free software you can install on any computer. When your child is happy with their design, the software exports an 'STL' file. This file is then put into another free program called a 'slicer' (like Ultimaker Cura or Bambu Studio) that prepares it for a 3D printer. This is a great project to explore together!

πŸ“š Learn More

← Previous