On this page
Key takeaways
- One prompt made all three parts. In 4 minutes Opus wrote 207 lines of OpenSCAD: a base with four Ø4.0 × 6 mm heat-set insert holes, a tray that slides on 1.2 mm grooves and a lid with countersunk screws. It came with 13 named features and 13 sliders.
- You can edit the code yourself, and the agent keeps your edit. I typed a sensor window into the code editor in Advanced mode. It rendered straight away, with its own feature chip and four new sliders, and no AI call.
- The next turn built on my code. Asked for a twin window and wall-mount keyholes, Opus kept my parameter names, my feature name and my comment, and wrapped my one cut in a loop instead of rewriting it.
- Check what the agent assumed. My prompt never said how high the USB port sits, so the agent used 6 mm and listed it under "Defaults adopted". With an ESP32 DevKit on headers, the port sits at 11.7 mm. One slider fixes it.
- 83 minutes and 46 g of PLA for all three parts, with no supports. Add four M3 inserts, four M3 × 6 countersunk screws and four M2 self-tapping screws.
The plan: a box you open without unscrewing the board
Most ESP32 projects in our Arduino and ESP32 build guides end the same way: a perfboard with a dev board and a sensor on it, and nowhere to put it. A snap-fit case, like the Raspberry Pi 5 case in our Kimi vs Opus vs Astra test, is great for a board you set up once. A sensor box needs something different: a lid you can take off over and over, and a board you can lift out to reflash or rewire.
So this box has three parts. The lid screws into brass heat-set inserts, which survive being opened many times, unlike screws driven straight into plastic. The board sits on a tray that slides out of the back on grooves, so you never unscrew the board to get at it. The base has vents low on both sides and in the lid, so air can flow past the sensor.
All of it happened in one chat on Claude Opus 5.5 with Advanced mode on. Advanced mode adds a code editor next to the chat, and this story is mostly about what happens when you use it.
| Step | Who did it | AI turns | Time |
|---|---|---|---|
| Base, tray and lid from one prompt | Opus | 1 | 4 min 7 s |
| A sensor window typed into the code | Me, in the code editor | 0 | instant render |
| A twin window and wall-mount keyholes | Opus, building on my edit | 1 | 2 min 41 s |
Times are from the chat's own timers. Each Opus turn costs 3x a Kimi message.
Turn 1: the whole box from one prompt
I wrote the prompt the way I would brief a person: what each part does, every size I know, which hardware goes where, and which numbers should be sliders. The insert hole is the standard size for M3 heat-set inserts (Ø4.0 mm, 5.7 mm long), with 0.3 mm extra depth so the insert can sit below the surface.
Design a three-part enclosure for an ESP32 sensor board: a base box, a sliding PCB tray and a vented lid. My board is a 50 x 70 mm perfboard (1.6 mm thick) with an ESP32 dev board and a BME280 soldered on; the tallest part is 15 mm above the board. It has four 2 mm mounting holes, 3 mm in from each edge. The tray is a 2 mm plate with four 5 mm tall standoffs (M2 self-tapping pilot holes) under those holes. It slides into the base along grooves in the two long walls through an open back end, and has its own back wall that closes that end when it is pushed home. The board's USB-C port faces the front wall, so cut a 12 x 7 mm opening there, centred on the board by default. The lid screws down with four M3 screws into heat-set inserts: put 4.0 mm wide, 6 mm deep insert holes in 8 mm bosses in the base corners, keeping the bosses clear of the tray's path, with countersunk M3 clearance holes in the lid. Add vent slots in the lid over the board and a row of low vent slots in both long walls so air flows past the sensor. 2 mm walls and 1 mm clearance around the board. Make the board size, the mounting hole positions, the standoff height and the USB opening's position and size sliders, so other people can reuse this box for their own board. Lay the three parts out side by side, each oriented to print without supports.
Three parts, 13 features, laid out to print
// @feature: marker in the code.- Time
- 4 min 7 s
- Code
- 207 lines, 13 features
- Sliders
- 13, plus 3 colours
- Layout
- 199.8 × 78.2 × 28.6 mm
- Base
- 68 × 76 × 28.6 mm
Opus put the four insert bosses in "ears" on the outside corners, so the inside of the box is a clean 52 × 72 mm channel for the tray. Each groove takes 1.2 mm out of the 2 mm wall, so it added a 45° rib on the outside to bring the wall back to 2 mm there. The lid got a 3 mm skirt at the back that stops the tray sliding out while the lid is on.
- Every number from the prompt is in the code: 4.0 × 6 mm insert holes, Ø1.6 M2 pilots, 2 mm walls and 1 mm clearance.
- The design brief listed what it would check before writing any code: 4 insert holes, 4 countersunk holes, 4 pilot holes, 18 side vents and 12 lid vents.
- It warned that the layout is just under 200 mm wide and fits a 220 mm bed.
- The USB opening sits 6 mm above the board, which is a guess. My prompt never said how high the port is. It is listed under "Defaults adopted", and I come back to it below.
- The low side vents sit mostly below the board. That is fine for airflow, but none of them are next to the sensor, which is what my hand edit fixes next.
Turn 2: I edited the code myself
The BME280 sits near the left wall, and an ESP32 runs warm. A temperature sensor in a closed box mostly measures the chip next to it, so I wanted an opening right beside the sensor. It is a small cut, so instead of asking for it I opened the Code pane and typed it in.
// added to the parameters at the top: each one becomes a slider
// Sensor window: position along the left wall (+Y = back)
sensor_window_y = 20;
// Sensor window: centre height above the board top
sensor_window_z = 6;
// Sensor window length along the wall
sensor_window_length = 14;
// Sensor window height
sensor_window_height = 6;
// added inside base_box(), after the side vents
// @feature: sensor_window
// open slot beside the BME280 so it reads room air, not the ESP32
translate([-(cavity_width / 2 + wall_thickness / 2), sensor_window_y,
board_top_z + sensor_window_z])
cube([wall_thickness + 2 * groove_depth + 2, sensor_window_length, sensor_window_height],
center = true);
Four parameters at the top of the file and a six-line cut in base_box(). I copied the style of the agent's own code: a comment above each parameter and a // @feature: marker.
When I stopped typing, the model re-rendered, going from 7,530 to 7,550 triangles. Because I followed the file's conventions, the page treated my code like the agent's. The // @feature: sensor_window line became a chip, and the four commented numbers became sliders in the Params tab. No AI was involved.
sensor_window chip in the feature list.Turn 3: the agent builds on my edit
Next I wanted the same slot on the other side, so air flows straight across the sensor instead of into a dead end. I also wanted a way to hang the box on a wall. I clicked my new chip, which put @feature[sensor_window] in the message, and pointed at my own code:
@feature[sensor_window] I added this slot by hand, next to the BME280. Give it a twin in the right-hand long wall so air can flow straight across the sensor, driven by the same sensor_window sliders. Then add two wall-mount ears to the base with keyhole slots for 4 mm screws, placed where they do not block the tray, the vents or the USB opening, so the box can hang on a wall.
My window, twinned, plus keyholed ears
wall_mount_ears and wall_mount_keyholes. sensor_window is the same chip as before.- Time
- 2 min 41 s
- Change
- +48 / −5 lines
- Layout
- 158.4 × 156.9 × 28.6 mm
- New sliders
- mount_screw_diameter, mount_ear_y
- My 4 sliders
- kept as written
Opus did not rewrite my window. It wrapped my translate in a two-step loop that mirrors it to the right wall, kept my comment and added one of its own below it. For the ears, it put a 3 mm plate on each long wall at floor level with a keyhole slot. That is below the vents (which start at Z 7.3 mm), in the middle of each wall and outside the tray's path. The layout became two columns, which brought it down from 200 mm wide to 158 mm.
- My four parameter names, their values, the feature name and my comment are all unchanged.
- The only change it made to my lines was the comment "the left wall", which became "both long walls". That is correct now.
- The keyhole slot runs from the head hole toward the back, because the box hangs USB-down. The brief explained why.
- The ears stick out about 9 mm on each side, so the box is 85 mm wide on the wall instead of 68 mm.
- The box hangs with its floor flat against the wall, so the screw heads have to be set about 4 mm proud before you hang it. The brief says so, but it is easy to miss.
// Sensor windows: position along both long walls (+Y = back)
sensor_window_y = 20;
// @feature: sensor_window
// open slot beside the BME280 so it reads room air, not the ESP32
// (twinned in both long walls for straight cross-flow over the sensor)
for (s = [-1, 1])
translate([s * (cavity_width / 2 + wall_thickness / 2), sensor_window_y,
board_top_z + sensor_window_z])
cube([wall_thickness + 2 * groove_depth + 2, sensor_window_length, sensor_window_height],
center = true);
// @feature: wall_mount_keyholes
for (sx = [-1, 1])
translate([sx * mount_keyhole_x, mount_ear_y, -1])
linear_extrude(height = mount_ear_thickness + 2) keyhole_2d();
My block, wrapped in for (s = [-1, 1]). The wall_mount_keyholes feature is new.

// keyhole: head hole at -Y, slot runs toward +Y (box hangs USB-down)
module keyhole_2d() {
translate([0, -mount_slot_travel / 2]) circle(d = mount_head_diameter);
hull() {
translate([0, -mount_slot_travel / 2]) circle(d = mount_slot_width);
translate([0, mount_slot_travel / 2]) circle(d = mount_slot_width);
}
}
Sized from one slider: a Ø9 head hole and a 4.5 mm slot for a 4 mm screw, 7 mm of travel.
Inside the box
Renders show the outside. To check the inside, I cut the assembled box in two places, with the stand-in board on the tray and the lid on.
- Insert bosses. The Ø8 boss leaves 2 mm of plastic around the Ø4.0 hole, which is the usual minimum for an M3 heat-set insert. The holes are 6 mm deep, so the 5.7 mm insert sits just below the surface.
- Grooves. The tray plate runs in 1.2 mm grooves with 0.3 mm clearance on each side. With the lid off it slides all 80 mm out without touching anything. I checked this in 5 mm steps.
- The lid locks the tray. With the lid on, the tray's back wall hits the lid's 3 mm skirt after about 0.2 mm of travel, so the tray cannot slide out.
- Nothing collides. Assembled, the base, tray, lid and stand-in board overlap by 0 mm³.
- Air path. The 18 side vents sit low, mostly beside and below the board, and 12 slots in the lid sit above it. Warm air from the ESP32 can rise out of the lid while room air comes in at the sides and through the sensor windows. I have not measured this; it is just how the openings are placed.
Fit it to your own board
This is what the sliders are for. In the Params tab, the board size, mounting hole insets, standoff height and the USB opening each have a slider and a typing box. The base, the grooves, the tray, the bosses, the vents and the lid are all calculated from them.
Now the USB port. My prompt said "centred on the board" but gave no height, so the agent set the opening's centre 6 mm above the perfboard and listed it under "Defaults adopted". On my stand-in, the DevKit sits on 8.5 mm female headers. That puts the port's centre 11.7 mm above the perfboard, and the opening misses it completely.

One slider fixes it. To make the fix permanent in the code, type it as a chat line. A message that is only name = value pairs is applied in the browser without calling the AI:
usb_center_above_board = 11.7
The same goes for a port that is not centred. The usb_offset_x slider starts at 0, so a port left of centre needs a negative number. Type usb_offset_x = -6 (or whatever you measure) the same way.
| Your board | Sliders to change |
|---|---|
| A different perfboard or PCB | board_width, board_length, board_thickness |
| Mounting holes not 3 mm from the edge | hole_inset_x, hole_inset_y |
| Something taller (an OLED on headers, a big capacitor) | component_height |
| DevKit on headers, or soldered flat | usb_center_above_board: port centre above the board |
| Micro-USB, or a plug with a big boot | usb_width, usb_height |
| Sensor somewhere else along the wall | sensor_window_y, sensor_window_z |
| Thicker wall screws | mount_screw_diameter |
Printing and assembly
The base prints upright, the tray prints plate-down and the lid prints upside down, so its countersinks face the bed. The longest bridge is the 14 mm top of each sensor window, and the USB opening is a 12 mm bridge. A bridge that short prints cleanly in PLA.
| Part | Printed size | Time | Filament |
|---|---|---|---|
| Base (with wall ears) | 85.4 × 76 × 28.6 mm | 42 min | 25.2 g |
| Tray | 53.8 × 73.7 × 25.4 mm | 22 min | 12.0 g |
| Lid | 68 × 78.2 × 5 mm | 19 min | 8.7 g |
| All three | 1 h 23 min | 45.9 g |
Each part sliced on its own. They also fit on one plate together.
- AI turns
- 2
- hand edit the agent kept
- 1
- supports
- 0
- overlap, assembled
- 0 mm³
- Hardware: 4 × M3 heat-set inserts (Ø4.0 hole, up to 5.7 mm long), 4 × M3 × 6 countersunk screws, 4 × M2 × 6 self-tapping screws for the board, and 2 × 4 mm screws for the wall. An M3 × 8 is too long: it would reach the bottom of the 6 mm hole.
- Set the inserts first. Use a soldering iron with an insert tip at about 220 °C for PLA. Press each insert straight down until it sits just below the top of the boss, then let it cool before you fit the lid.
- Then the board. Screw the perfboard to the tray's standoffs, slide the tray in from the back with the USB end first, and screw the lid on.
- Use PETG if the box will be outdoors or in the sun. PLA starts to soften at around 55 °C, which a box in direct sun can reach.
- Measure your board before the first prompt
Width, length, hole positions, the tallest part, and how high the USB port sits above the board. Anything you leave out, the agent will guess.
- Ask for sliders and named features
They are what make the box reusable, and the chips are what make later edits precise.
- Make small changes yourself
A slot, a hole or a different number is often quicker to type than to explain. Copy the file's style, with a
// @feature:marker and a comment line above each number, and it gets a chip and sliders. - Then ask for the next step by pointing at your edit
Click its chip and say what to do with it. The agent starts from the code as it is now, your lines included.
- Read "Defaults adopted"
That is where the agent lists what it guessed. Check each one against your board.
Sources and method
Made on November 29, 2026, in one CAD agent chat on a PrintPal Pro account, with Claude Opus 5.5, Advanced mode and Auto-improve on. The prompts are shown above, unedited. The hand edit was typed into the page's code editor and is shown in full. Times are from the chat's timers. The OpenSCAD for each version and the chat text were saved straight from the page, and the claims about what each turn kept or changed come from line diffs between those files. Renders, animations and cross-sections are those files rendered with OpenSCAD's manifold backend, with a stand-in board (a 50 × 70 mm perfboard, an ESP32 DevKit on 8.5 mm headers and a BME280 breakout) modelled from typical sizes. Overlaps and the tray's slide path were measured as mesh intersections. Print times and filament are Bambu Studio estimates for an X1 Carbon at 0.20 mm in PLA. Nothing has been printed. PrintPal makes the CAD agent.
- PrintPal AI CAD agent
- ESP32-DevKitC user guide
- Bosch BME280 product page
- OpenSCAD documentation
- Bambu Studio
Spotted something out of date? Tell us and we will re-check it.


