L1 · DS-110

Your First Parametric Part

Drive a real build123d part from named Python variables instead of magic literals, so one number reshapes the whole solid. Pass = result is a 60 x 40 x 8 mm plate with a centered 6 mm through-hole: bounding box within +/-0.1 mm AND volume within +/-1 mm3 of 18973.81 (box volume minus the drilled cylinder), proving the hole is really cut, not faked.

01
Challenge

Try this first — before any explanation.

The Bench opens running real build123d on the OpenCascade kernel, and the 3D viewer shows a solid plate. The starter builds Box(plate_x, plate_y, plate_z) from named variables but never drills the hole. The autograder reports the bounding box is correct (60 x 40 x 8) yet the volume is 19200 mm3 - exactly box volume - when the spec wants 18973.81 mm3, a 6 mm hole removed. The obvious cold move is to hunt for a number to subtract; the trap is that a real part is not a number, it is geometry. To lose that 226 mm3 you must actually subtract a Cylinder from the Box and let the kernel recompute the volume. The felt gap between a printed dimension and a cut solid is the whole lesson: parameters drive geometry, and geometry is measured, not asserted.

The Bench

This Bench runs real build123d on the OpenCascade kernel (Pyodide + OCP.wasm) and renders result in a 3D viewer. Define result as a build123d solid. The autograder reads result.bounding_box().size and result.volume and grades them against the spec: a 60 x 40 x 8 mm plate with a centered 6 mm through-hole. The starter already builds the plate from named parameters but skips the hole - the bbox passes, the volume fails, until you actually cut a Cylinder out of the Box.

PARAMETRIC CAD

Your First Parametric Part

This Bench runs real build123d on the OpenCascade kernel (Pyodide + OCP.wasm) and renders result in a 3D viewer. Define result as a build123d solid. The autograder reads result.bounding_box().size and result.volume and grades them against the spec: a 60 x 40 x 8 mm plate with a centered 6 mm through-hole. The starter already builds the plate from named parameters but skips the hole - the bbox passes, the volume fails, until you actually cut a Cylinder out of the Box.

02
Model

The idea, built visually.

Here is a plate: sixty long, forty wide, eight thick. Right now every one of those numbers is a literal, typed straight into the code. It works - the viewer shows a solid block. But a loose number doesn't know what it means. It doesn't know it's the length. So we give each one a name: plate_x, plate_y, plate_z, hole_d. Same part, but now the code reads like intent. And here's the part that matters: this is real geometry, not a description of geometry. When the spec asks for a hole, you can't just print a smaller volume - you have to make a Cylinder and subtract it from the Box, and the kernel recomputes the volume for you. Box minus cylinder. The bounding box doesn't change, because the hole lives inside the envelope, but the volume drops by exactly pi times r squared times the thickness. Change hole_d from six to ten and the cut grows automatically, because the radius is hole_d over two - a derived value, computed once. That's the whole idea: name your numbers, and let the solid follow them.

▣ Stage animation: Cold open: a navy canvas, a build123d plate rendered as a solid block, with 60, 40, 8 floating as scattered gray literals; question 'What if every dimension knew its own name?'. Beat 1: the three literals fly up and snap into a named block (plate_x=60, plate_y=40, plate_z=8, hole_d=6), each connecting by a thin line to the edge it controls; caption 'a named number carries meaning.' Beat 2 (core idea): a Cylinder ghosts into the center of the plate, then a boolean-cut animation bores it through; the bounding box wireframe stays fixed at 60x40x8 while a volume readout ticks 19200 -> 18973.81; caption 'the hole lives inside the envelope - bbox unchanged, volume drops by pi*r^2*h.' Beat 3: hole_d scrubs 6 -> 10, the bore widens live and the volume readout falls further; caption 'radius = hole_d/2, so the cut follows the parameter.' Beat 4: UI mock, the parameter block highlighted at top, a green chip BBOX OK (60x40x8) and a second chip VOLUME OK (18973.81) both lighting.

03
Guided practice

Build it up, step by step.

Step A (read the starter): the params plate_x, plate_y, plate_z, hole_d already sit at the top, and result = Box(plate_x, plate_y, plate_z) builds the envelope. Run it: the viewer shows a solid block and the grader says bbox is correct but volume is 19200, not 18973.81 - the hole is missing. Step B (make the hole): a through-hole is a Cylinder subtracted from the Box. Add hole_r = hole_d / 2.0, then build hole = Cylinder(radius=hole_r, height=plate_z) so it spans the full thickness, and change the last line to result = Box(plate_x, plate_y, plate_z) - hole. The minus sign is a real boolean cut on the kernel. Step C (verify the drop): the cut removes pi * hole_r^2 * plate_z = pi3^28 ~= 226.19 mm3, so volume should land at 18973.81; the bbox is unchanged because the hole is interior. Step D (independent): confirm result is the cut solid (a Part), the bounding box reads 60 x 40 x 8 within +/-0.1, and the volume is within +/-1 of 18973.81. Final hint: if your volume is still exactly 19200, you printed a number instead of subtracting a Cylinder - geometry is measured, not asserted.

04
Feedback

How the Bench grades your run.

PASS WHEN PASS prints when result's bounding box is 60 x 40 x 8 mm within +/-0.1 on every axis AND its volume is 18973.81 mm3 within +/-1 - that is box volume (19200) minus the drilled cylinder (pi*3^2*8 ~= 226.19). The bbox alone passes from the start; the volume only lands when a real Cylinder is subtracted from the Box, so a printed number can't fake it. Deterministic - same code, same measured solid every run.

  • Bounding box is correct (60 x 40 x 8) but volume is 19200.0 mm3, exactly box volume - the hole is missing. Subtract a Cylinder from the Box: result = Box(...) - Cylinder(radius=hole_d/2, height=plate_z).
  • Volume is 18925.0 mm3, too low: your hole is too big. Use radius = hole_d/2 = 3 (a 6 mm diameter), not radius = hole_d. pi*3^2*8 ~= 226 mm3 should be the only material removed.
  • Volume is right but the bounding box reads 50 x 40 x 8 - plate_x is wrong. Set plate_x = 60 so the X envelope matches the spec.
  • result is not a build123d solid (bounding_box failed). Make sure the last line assigns a Part/Solid to result, e.g. result = Box(plate_x, plate_y, plate_z) - hole.
  • Your cylinder is shorter than the plate, so the hole is a blind pocket and the volume is slightly off. Set height = plate_z so the bore goes all the way through.
05
Retrieve & space

Bring back what you've already mastered.

  • build123d recall: how do you make a solid box 60 long, 40 wide, 8 thick? -> Box(60, 40, 8), where the three args are X, Y, Z in mm.
  • build123d recall: how do you cut a through-hole? -> subtract a Cylinder from the solid, e.g. Box(...) - Cylinder(radius=r, height=t); the minus is a boolean cut on the kernel.
  • This lesson (derived dimension): given a hole DIAMETER hole_d, what radius do you pass to Cylinder? -> hole_d / 2. Locks in that a diameter-6 hole is radius 3, and that the parameter drives the cut.
06
Mastery gate

What you must demonstrate to advance.

Submit a single build123d program where the plate dimensions and hole diameter are named parameters and result is Box minus a Cylinder: the autograder confirms bbox 60 x 40 x 8 within +/-0.1 mm AND volume 18973.81 mm3 within +/-1, plus retrieval cards 1-3 cleared. This is the L1 competency - turn a real shape into parametric build123d code whose geometry (not a printed number) meets an exact envelope and volume.

07
Project

How this feeds your build.

Not a standalone capstone, but the hinge of the course. Naming parameters and cutting real features is the skill Module 2 turns into constrained part-families, Module 3 uses to size mating parts, and Module 5 uses to let an optimizer tune named parameters until the physics sim hits spec. This parametric plate is the first portfolio artifact: change one number, the kernel rebuilds a still-valid solid.