Designing hinges, snap-fits and moving parts for your enclosure in Flux

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 featureMeasured value
Pin diameter3.000 mm
Hinge bore diameter3.400 mm
Diametral clearance0.400 mm
Radial clearance0.200 mm
Axial gaps between adjacent knucklesFour gaps, 0.300 mm each
Closed lid seatingGravity-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.

Production render of the closed gray enclosure with connector openings and a removable-pin hinge.
The closed assembly uses the board's real connector geometry and alternating hinge knuckles.

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 checkMeasured value
Ordinary PCB side clearance1.000 mm on each side
Headroom above the highest modeled component2.800 mm
Clearance below the lowest modeled component3.200 mm
Minimum base-to-component clearance0.895 mm
Unintended base/PCB volumetric overlap0 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.

Production render of the enclosure lid at the checked 110-degree service pose with the computer board inside.
The open assembly shows the 110° service pose used for the geometry checks.

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.

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.

Production exploded render showing the lid, board, base, screws, inserts, pin, and retainer.
The exploded assembly separates the electronic board, printed shells, and hinge hardware.

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.

RequestWall timeAgent Compute Units
Board inspection and enclosure request840.335 seconds2.5
Model inspection, hinge design, and verification4,087.315 seconds50.9
Total recorded processing time4,927.650 seconds53.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

About the author

Matthias Wagner

Founder & CEO at Flux

Matthias is the Founder and CEO of Flux, a hardware design platform that's revolutionizing how teams create and iterate on circuits. Find him on Flux @natarius.

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.

Try it Free
Close-up of a Flux-designed printed circuit board