Intro to Parametric Design
What if you could write a magic spell to create your own toys, tools, and treasures? That's parametric design! You write the rules, and the computer builds your ideas. Ready to become a code magician? ๐ง
๐ Mission Briefing
This is a deep dive! Use these links to jump to any section:
Imagine building with LEGOs. To make a house taller, you have to add more bricks one by one. What if you could just tell the house "Grow taller!" and it did? That's what we're doing today with code!
Coding 3D Models with OpenSCAD
OpenSCAD is a free tool that lets you design 3D models with code. Instead of dragging shapes with a mouse, you write commands. If you want a box to be wider, you just change a number in your code, like width = 50;. It's powerful, precise, and lets you build amazing things.
๐ง The Three Magic Spells of CSG
Constructive Solid Geometry (CSG) sounds complicated, but it's just playing with digital blocks! There are three "spells" you'll use all the time:
Combine โจ
Glues shapes together to make a new, single shape.
Carve โ๏ธ
Uses one shape to cut a hole out of another.
Overlap ๐ค
Keeps ONLY the part where two shapes are both touching.
Mastering the Carving Spell
Let's practice the carving spell! In the code below, we're using difference() to subtract a cylinder from the center of a cube. Hit the button to see it in action.
โญ Your Next Mission:
Success! But uh-oh, our spy bolt is 16mm wide, which means it has a radius of 8. The current hole is too small! Find the right variable in the code and change its value to make the bolt fit, then hit 'Compile Geometry' again!
Make Something Uniquely YOURS!
Let's use our new skills to make something you can actually use: a custom name tag for your backpack. This is the perfect first project!
First, we need a solid block. This code makes a flat rectangle. The numbers are `[width, depth, height]`. Try changing them to see how the shape changes!
Now for the fun part! We'll use our difference() spell again, but this time with the text() command. Change "Pan" to YOUR name and hit 'Carve It!' to make it your own!
Wait, how did the text get in the right spot? ๐ค
Great question! The translate([x, y, z]) command is like a "move" tool. We told it to move our text 5mm to the right (the X value) and 8mm "up" from the bottom edge (the Y value) to position it perfectly on the tag before carving. You'll use this command all the time to assemble parts!
๐ค The Clone Machine! (Using `for` Loops)
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!
You've seen how to make a line of things on the X-axis. Now, let's build UP! Your mission: use a for loop and translate to stack 5 cubes on top of each other. Remember, the Z-axis is the last number in `[X, Y, Z]`!
๐งฑ Level Up: Build Your Own LEGO Block with `module`
Real programmers hate copy-pasting code. 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 with different properties!
We've turned the name tag code into a reusable module. Now you can make a tag of any size with any name just by calling one command! Your mission: Call the module to make a tag for "Pan", then call it a second time to make a smaller tag for a friend named "Alex" right below it.
Build a Planetary Gear System
This is a true engineering puzzle! A planetary gear system has a central "sun" gear and several "planet" gears that orbit it. Your mission is to use a for loop, rotate(), and translate() to place 5 "planet" gears in a perfect circle around the central sun gear.
โจ The Next Frontier: Your AI Co-Pilot
Coding shapes is powerful, but what if you could just... ask for a shape? That's the next adventure! Tools like Luma AI Genie let you type "a happy turtle wearing a tiny top hat" and an AI will generate a 3D model for you! The coolest part is using AI as your co-pilot. You can generate a base model with AI, then import it into a tool like Blender (or even OpenSCAD!) to add your own custom parts and parametric features. It's the perfect blend of AI creativity and your engineering control.
๐ก๏ธ AI Safety Check
- Be the Director: Use AI as a starting point. It's a tool to help your creativity, not replace it! You're the one in charge.
- 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 Luma Genie are amazing for creativity but often require an account (and parental consent). This is a perfect "explore together" activity. You can co-pilot the sign-up and be amazed at what your child dreams up!
๐ Learn More
- OpenSCAD's Official Cheat Sheet - The perfect one-page reference guide!
- Explore Models on Printables.com - See what others are building and get inspired! (Requires account with parental consent to upload/download).
- Deep Dive: Using Arguments in OpenSCAD Modules - A guide to making your modules even more powerful.
- Maker's Muse: Real-World Parametric Design (Video) - See how a pro uses these concepts to solve real problems.