Designing hinges, snap-fits and moving parts for your enclosure in Flux
Flux is an AI hardware engineer that designs the electronics and mechanical parts of a device in one project. For a moving enclosure, start with the board, choose a hinge or snap-fit mechanism, and specify the mating geometry. This walkthrough uses a removable-pin hinge around a real 72 × 100 mm ESP32 computer board.
The result is a PETG base and lid, a five-knuckle hinge, a removable pin, and closed and open assemblies. Independent measurements of the exported files reproduced the 3.0 mm pin, 3.4 mm bores, four 0.3 mm axial gaps, and 1.0 mm board-side clearance. The two requests took about 82 minutes of recorded processing time and used 53.4 Agent Compute Units.
1. Start from an editable fork of the board
Open the public ESP32 x86 PC project. Use the project action menu to select Fork Project, then choose your workspace. Work in that fork so the PCB and its component models belong to the same project as the enclosure.
This board includes USB, VGA, PS/2, and card connectors. Its native 3D export measures 72 × 100 × 1.29936 mm. Four 2.2 mm mounting holes sit at layout coordinates (±33, ±47) mm. Those features define the support positions, connector openings, and enclosure envelope.
The first request specifies the mechanism, fit, motion, and files together:
Design a PETG enclosure with a working pin-hinged lid around THIS project's actual PCB. This is an editable fork of vasy_skral/esp32-x86-pc; use the CURRENT project's native board 3D export, not a guessed rectangle or cross-project export. Read board, components, connectors and mounting holes. Keep electronics unchanged. Use 1 mm side clearance, 2 mm component headroom, 3 mm removable pin, 3.4 mm hinge bores and 0.3 mm axial gaps. Check closed fit and 0-110 degree opening for interference with board, case and pin; report measured clearances and failures. Produce named closed/open STEP assemblies with actual PCB, separate watertight printable base/lid STLs, pin STEP, source, fit report and PNG renders closed/open/exploded. State print orientation and tolerances; verify board retention and assembly paths. If actual PCB export or a functional hinge is blocked, stop and report; do not substitute a decorative hinge. No orders, checkout, payments or external messages.
Read Make mechanical parts for the mechanical design workflow. Keeping the actual board in the project lets the enclosure use its connector positions and component heights.
2. Inspect connector orientation without changing the electronics
Connector orientation determines both the opening and the direction in which a cable enters. Give Flux permission to inspect the footprint and manufacturer drawing before it changes a component model. This run used the following exact follow-up:
Yes, correct USB1's 3D-model transform in THIS fork if its footprint and manufacturer drawing show it is wrong. Verify mounting orientation first. Keep footprint, PCB placement, parts, nets and connections unchanged. Then continue straight to a functional PETG enclosure with a hinged or snap-fit lid around the actual PCB and connectors. Retain 1 mm side clearance, 2 mm component headroom, and, for a hinge, a 3 mm removable pin, 3.4 mm bores and 0.3 mm axial gaps. Check PCB/connector fit, retention, connector mating paths, assembly and 0-110 degree opening for interference. Deliver measured tolerances/clearances, named closed/open STEP assemblies, separate watertight printable STLs, editable source and closed/open/exploded PNG renders in this fork. Proceed through design and verification without another checkpoint for these authorized choices. No orders, checkout, payments or external messages.
The inspection supported USB1's existing upright side-mount orientation, so Flux kept its transform. The enclosure design used the existing PCB, hole positions, and component models. The closed assembly retained the 91 modeled electronic entries from the board reference.
3. Specify pin, bore, and knuckle clearances
The hinge alternates three base knuckles with two lid knuckles. A removable pin runs through their common axis. The main case outline is 80 × 108 mm before the hinge projection. Ordinary walls are 3.0 mm thick; the floor and lid plate are each 2.4 mm thick.
| Nominal CAD feature | Measured value |
|---|---|
| Pin diameter | 3.000 mm |
| Hinge bore diameter | 3.400 mm |
| Diametral clearance | 0.400 mm |
| Radial clearance | 0.200 mm |
| Axial gaps between adjacent knuckles | Four gaps, 0.300 mm each |
| Closed lid seating | Gravity-seated on seating lands |
These dimensions define the CAD fit. Keep radial clearance separate from diametral clearance: the difference between the bore and pin diameters is 0.4 mm, while the space on each side of a centered pin is 0.2 mm. Use the nominal geometry to set the print process and bore calibration.

4. Check the board, components, and lid motion
Independent checks imported the final native STEP and measured the enclosure against the PCB and component solids. The measured fit was:
| Fit check | Measured value |
|---|---|
| Ordinary PCB side clearance | 1.000 mm on each side |
| Headroom above the highest modeled component | 2.800 mm |
| Clearance below the lowest modeled component | 3.200 mm |
| Minimum base-to-component clearance | 0.895 mm |
| Unintended base/PCB volumetric overlap | 0 mm³ |
The enclosure retains the board with four screws and inserts. Its cutouts follow the modeled connectors. The fit report also records provisional cable access envelopes and assembly paths. Use Fit and clearance to define the specific mating parts and access spaces for your device.
The independent motion check sampled 111 poses from 0° through 110° at 1° intervals. It checked the lid against the base, PCB, a component envelope, pin, and retainer. None of those samples had unintended overlap above the 0.001 mm³ check threshold. The exported open assembly's lid plane measured 110.000° relative to its closed pose.

5. Export the shells, pin, and assemblies
Flux produced separate printable base and lid meshes, a pin solid, editable source, and named assemblies containing the actual board. Independent mesh checks found both STLs watertight, consistently wound, and connected as one body each.
- Base STL: 85,890 triangles, oriented floor-down.
- Lid STL: 2,620 triangles, oriented edge-down with the hinge axis vertical.
- Pin STEP: a separate solid for the removable pin.
- Closed STEP archive and 110° open STEP archive: named solid assemblies.
- Editable source pack and measured fit report.
Use the STLs for the PETG print workflow. Extract the STEP archives to carry named solid geometry into downstream CAD or CAM. See Mechanical drawings and exports for the file workflow.

Recorded time and Agent Compute Units
The run starts with the editable fork and includes both exact requests above. Wall time measures each request through its final result. Agent Compute Units measure the reported compute use; work within each request is included in that total.
| Request | Wall time | Agent Compute Units |
|---|---|---|
| Board inspection and enclosure request | 840.335 seconds | 2.5 |
| Model inspection, hinge design, and verification | 4,087.315 seconds | 50.9 |
| Total recorded processing time | 4,927.650 seconds | 53.4 |
For a complementary fabrication example, follow the sheet-metal bracket walkthrough. For enclosure loads and heat paths, read the thermal and stress simulation walkthrough.
FAQs
Work in an editable project that contains the PCB and its component models. Specify the enclosure material, board clearances, hinge geometry, opening angle, and export files. This example starts from a fork of a 72 × 100 mm ESP32 computer board.
The nominal CAD pin diameter is 3.0 mm and the bore diameter is 3.4 mm. That gives 0.4 mm diametral clearance and 0.2 mm radial clearance. Four axial gaps between adjacent knuckles measure 0.3 mm each.
Independent geometry checks sampled 111 lid poses at 1° intervals from 0° through 110°. The checks included the base, PCB, component envelope, pin, and retainer. No sampled pose had unintended overlap above 0.001 mm³.
Flux produced separate watertight base and lid STLs, a pin STEP, and named closed and open STEP assemblies in compressed archives. It also produced editable source, a measured fit report, and closed, open, and exploded PNG renders. The STLs include print orientations for the PETG shells.
More in PCB Design & Engineering Fundamentals
Let’s start building.
Let’s build your idea together. All you need to do is describe what you want to make, or what problem you want to solve. Flux will work with you to make it a reality.