kapy academy

Enclosure lids

21 min readUpdated Nov 2026

The lid rattles, only closes one way round, the clip snaps on the first close, or the lid flies off when the box drops. These failures come from asking one feature to do more than one job. Closing a box is three jobs: locating the lid so it resists pushes and seats the same way every time, retaining it so it does not lift off and, sometimes, sealing. Give each job to exactly one feature. A lip, grooves or a hinge locate; a screw, a clip, a magnet or a detent retains; a gasket seals, if something clamps it.

Split lipZ gapRebateClearanceLipSliding lidGrooveDetentClipsWindowTongueHingeAxisStopSweepBedLocatesRetains
The four families in section. In each one, the highlighted outline is what locates the lid and the arrow is what retains it. Below, how each half sits on the bed.

Where to split the box

Split the box on a horizontal plane, at a height where the walls are vertical. That way both halves print right way up with no supports: the base on its floor and the lid on its top face. The lid's top face sits on the bed and its edge gets elephant's foot, so chamfer it 0.5 × 45° (The face on the bed). The two rims that meet at the split are the last layers of each print, not bed faces, so there is no elephant's foot at the joint.

How tall the lid is depends on where the contents are mounted. If the board and the hardware sit on the floor, make a shallow lid: you reach in from above and the lid only has to clear the tallest component, with at least 2 mm of air, as in Enclosures and mounts for Raspberry Pi. If something is mounted on the walls, the split runs above it. Either way, the lid must be taller than the lip plus its clearance.

Look at the connectors before you fix the split height. A cutout in a vertical wall has a roof when it prints, and that roof is a bridge or a teardrop (Connector cutouts). If the split runs through the connector line, each cutout becomes two open U-notches with no roof, and the board drops in from above with the connectors already in place. If the split misses them, keep each cutout whole inside one half, never 1–2 mm from the split: that thin strip of wall breaks.

Anything heavy or fixed (the board, the battery, the power supply, the mains inlet) goes in the base. Do not mount anything cabled in the lid: the cable would decide how far it opens.

The split shows. The lid can sit off-center by up to the clearance (0.2 mm), and that step catches raking light. Put the split on an edge or step the shape already has, or add a reveal: a 0.5 × 45° chamfer on both outer edges of the split, which hides the offset (Splitting large parts).

Front and back panels can slide into slots in the base walls and be trapped by the lid, with no fasteners of their own. Printed, acrylic and plywood panels all work: slot = measured panel thickness + 0.4 mm, the sliding clearance of 0.2 per side. In an aluminum extrusion frame, the panel is held in the extrusion's slot (2020 aluminum extrusion).

Split lip

The inner part of the base wall rises above the split to form a lip. The lid has a rebate inside its wall that takes it. The lid seats rim to rim and the lip only centers it: the lid centers on one set of surfaces, and everything else stays free, with clearance (Assemblies and tolerance stackups).

BossGapInsertLidBaseRebateSkinClearanceRevealRimZ gapLead-in chamferLipAs printedBaseLidBedLast layer
The worked example, dimensioned. 2.4 mm wall = 1.0 lip + 0.2 clearance + 1.2 skin. One layer of air above the lip, so the lid sits on the rim. The lid boss stops 0.2 mm short. On the right, the two halves as printed: the rims at the split are the last layer.

Sharing out the wall

Wall thickness = lip + clearance + lid skin. The skin left beside the rebate is the weakest wall in the box: keep it at 1.2 mm or more (3 lines). With the usual 2 mm wall and a 1 mm lip, the skin drops to 0.8 mm, two lines: it prints, but it cracks at the first knock. A lipped box wants a 2.4 mm wall (lip 1.0, clearance 0.2, skin 1.2). It is the same sum as the tongue and groove in Splitting large parts.

Side clearance, per side

If you want a lid that goes on and off without effort, the gap between the outer face of the lip and the rebate is the sliding clearance: 0.20 mm on a modern bedslinger, 0.15 on an enclosed CoreXY. If you want it to hold by friction, use the locating fit: about 0.10 mm (Real printed clearances). Do not think in diameters: the rebate stands off the lip by c all the way round, so the lid can move ±c and the total play from side to side is 2c. If you add 0.2 mm to the rebate's width, you do not have the sliding clearance: you have 0.10 per side.

The Z gap

The rebate is deeper than the lip by at least one full layer, so the lid sits on the rim and the lip never bottoms out. With 0.20 layers that is 0.2 mm; with 0.28 layers, 0.28. A value that is not a whole number of layers can round to zero in the slicer.

Lip height

The lip stands 2 to 5 mm tall. The taller it is, the better the lid resists rocking and knocks; 3 mm is a good starting point. Chamfer the lip's upper outer edge 0.5 × 45° as a lead-in: printed, it is an upward slope and needs no support.

A friction-fit lid loosens

At 0.10 mm clearance, the lip and the rebate relax under constant pressure, in any common plastic (Creep and fatigue). Retain the lid with something that does not rely on interference (screws, clips, magnets), or add crush ribs to the lip to soak up print-to-print variation without rattling (Crush ribs and compliant pins).

Long walls bow

In PETG, ABS or ASA, a long thin wall curves a few tenths inward or outward, and a continuous lip rubs in one place and rattles in another. Round the vertical corners in plan (Warping and lifting corners), add one or two ribs inside the long walls, or break the lip into segments: short tabs at the corners and mid-wall instead of a continuous ring.

Screws from lid to base

The lip takes the side loads; the screws only hold the lid down. The lid bosses are one layer (0.2 mm) shorter than they would need to be to touch the base bosses, so the screw clamps rim against rim, not boss against boss; otherwise two features locate the lid at once. Use heat-set inserts for anything you will open more than about ten times (Designing for heat-set inserts) and self-tapping screws below that (Self-tapping screws in plastic). The clearance hole in the lid follows ISO 273: 3.4 mm, medium series, for M3 (Why holes print small).

Sliding lid

A flat lid 1.6–2.0 mm thick runs in two grooves, one in each side wall, and the end wall it slides out through is cut down to the bottom of the groove. Use 45° flanks: the lid's edges beveled, wider at the bottom than the top, and the groove's upper flank at 45° too. Leave a 0.5 mm vertical land at the bottom and bevel only the rest of the thickness; a full-thickness bevel ends in a feather edge that lifts off the bed and reaches too far into the wall. The lid prints flat on its underside, so the bevel is an upward slope. The box prints right way up and the groove flank is a 45° overhang. Neither needs support. These are the same dimensions as in Board-game inserts.

Left, in section, the edge of a 1.6 mm lid with a 0.5 land and a 45° bevel inside the wall's groove: pushed sideways, the land meets the groove's bottom; lifted, the bevel meets the flank. Right, along the lid, the detent tongue: as the lid opens its bump climbs out of the notch up the ramp and the tongue lifts 0.5 over the cut-down wall; as it closes it rides over and drops into the notch
Left: the 45° groove with its two clearances, 0.2 per side horizontally and 0.4 vertically (two 0.2 layers), and the lid's vertical land, where the elephant's foot ends up; the clearances are drawn ×2. Right: the detent tongue at the end of the lid that closes over the cut-down wall, with its bump dropping into the notch; the tongue is drawn as a rigid bar pivoting 0.15·L from its root.

With a 1.6 mm lid and a 0.5 land, the bevel reaches 1.1 mm into the wall, and with the clearance the groove is 1.3 mm deep. At least 1.2 mm (3 lines) must remain outside the groove, so the wall wants at least 2.5 mm; 2.6–3 mm with margin. A 1.2 mm wall has no room for the groove: thicken it only along the groove, or build the grooves as a rail on top of the rim.

Horizontally, use the sliding clearance: 0.20 mm per side (0.15 on an enclosed CoreXY). Vertically, the groove is the lid thickness plus one layer and 0.2 mm of air, rounded to whole layers: 0.4 mm extra with 0.20 layers. That is more than the single layer that suffices between two flat faces, because the 45° flank is an overhang and sags a little.

The lid's land printed against the bed, so the elephant's foot sits right on the face that slides. Keep the slicer's elephant's foot compensation at its default and, if it still rubs, break that edge with a 0.3 × 45° chamfer. A sliding lid that jams halfway usually has this ridge, not a badly chosen clearance.

In a long groove, wall bow and shrinkage add up. Above about 150 mm in PETG or ABS, print a short test length first, as you would with a long tongue (Splitting large parts).

A sliding lid slides out if you store the box on its end. Give it a detent: a tongue cut into the lid, near the end that sits over the cut-down wall when closed (the last to go in), with its length in the layer plane and its flex in Z. A small bump on its underside drops into a notch in the cut-down wall. A 30° ramp gives a soft click; 45°, a firm one. Both release by hand (Snap-fit catches). Size the tongue like any clip arm (Print-friendly snap fits); the worked example ends with one calculated.

Clips

With a clip, what decides whether it survives is which way the arm runs. Arms with their length in Z snap along a layer: the arm's length in the layer plane (Layer orientation for mechanisms). That gives the two fixes. The better one is a horizontal tongue cut into the side wall with a U-slot, bending in the layer plane. The other is a tongue inside a flat lid, bending in Z and catching under a ledge inside the box, as on battery covers.

BedBreaksFlexVertical clipLayersHoldsFlexHorizontal tongueU-slotLayers
With the box printed right way up, a clip rising from the rim works with its length in Z and splits along a layer. Turned 90° into a tongue in the wall, it bends in the layer plane.

The lip or a pair of guides engages before the hooks reach their windows. That way a lid pushed on crooked never meets a hook first. The lip takes the knocks and the twisting; the hooks only hold the lid down.

The arm's strain, the root radius, the lead-in and retention angles and the ways to release it are in Print-friendly snap fits and Snap-fit catches, whose worked example happens to be a battery cover that opens at 12–20 N. What is specific to a lid: a retention face at 30–45° if you open it by hand, 80–90° if nobody should, and a thumb recess or release slot beside each hook.

For round boxes, use an annular bead or a slotted collar (Snap-fit catches), a thread (Printable threads) or a bayonet (Bayonet mount).

Hinge

Every point on the lid sweeps an arc around the axis. With the axis outside the back wall and level with the split (or below it), every point on the lid moves away from the box as it opens: up or backwards, never inwards, and the back lip does not get in the way. If the axis sits above the split, say with the knuckles mounted on top of the lid, or inside the wall's footprint, whatever lies below the axis sweeps inwards and the lid jams as it starts to open. In that case remove or chamfer the back lip and round the lid's lower back edge with a radius centered on the axis.

Let the open lid rest a little past 90°, at 100–110°, on a stop face between lid and box: that way the knuckles do not take the lever arm of a lid pushed backwards.

A print-in-place box prints with the box and lid side by side, the lid rotated 180° and the axis horizontal. Rotating 180° about an axis at height h puts the lid's top face at 2h − H from the bed, where H is the closed box height. For the lid to sit on the bed, h = H/2: split the box at mid-height, or bring the lid's knuckles down to the axis on an arm. In a 40 mm box, the axis goes at 20. The knuckles want 0.3 mm per face in PLA (0.35–0.4 in PETG), a Z gap of one layer plus 0.2 mm rounded to whole layers, and 45° cone pins instead of round horizontal holes (Print-in-place clearances, Print-in-place pins and hinges).

With a separate pin, a steel rod or a length of filament passes through horizontal holes in the knuckles, which print clean without support up to Ø6: hole = pin + 0.4 on the diameter, checked first on a coupon. How many knuckles and which two clearances they take is in Knuckle hinges.

A living hinge only lasts in PP (or TPU): a 0.4–0.6 mm web on the bed, with the lines crossing the fold in every layer of the web. In PLA or PETG it breaks before a thousand folds (Living hinges and flexures, Living-hinge folding box).

The hinge locates one edge; the opposite edge still needs retaining: a clip, magnets (Magnets in mechanisms) or an over-center latch (Over-center draw latch). If the lid must stay open at any angle, Friction hinge; at set angles, Detent hinge.

Choosing the closure

What locates and what retains, by use
Use Locates Retains Notes
Opened a few times a year and must stay shut Lip Screws Self-tapping up to about 10 openings; heat-set inserts beyond
Opened weekly, by hand Lip Wall tongues or magnets Lip engages before the hooks; magnets: Magnets in mechanisms
Opened daily, small parts, goes in a backpack Grooves or hinge Detent, clip or latch Sliding lid with detent, or hinge with clip or latch
The lid must not get lost Hinge Clip, magnets or latch Axis outside the back wall, level with the split
Dust or splashes Lip Screws or over-center latches The gasket only seals if something clamps it; a clip does not clamp
Round container Thread or bayonet The thread or bayonet itself Printable threads, Bayonet mount
Panel that opens without tools and must not vibrate Lip or frame Quarter-turn or captive screw Quarter-turn panel fastener, Captive thumb screw

For sealing, the gasket and its groove are in Printed TPU gaskets and O-ring grooves; if the wall itself lets water through, Watertight printed parts.

Worked example: a PETG sensor box

A 100 × 70 × 40 mm PETG box for a board screwed to the floor, opened a few times a year. A modern bedslinger (sliding clearance 0.20), 0.20 mm layers. From the table: split lip and screws. You fit two M3s diagonally opposite with heat-set inserts, because over its life you will open it more than ten times.

The split. A 12 mm lid: it clears the tallest component with 2 mm of air. 2.4 mm wall.

The lip. 1.0 mm thick and 3.0 tall, 0.20 clearance per side. Lid skin: 2.4 − 1.0 − 0.2 = 1.2 mm, three lines. The lid can move ±0.2 mm, 0.4 from side to side. A 3.2 mm deep rebate: that leaves one layer (0.2 mm) of air above the lip and the lid sits on the rim.

The finish. A 0.5 × 45° chamfer on both outer edges of the split: it hides the step of up to 0.2 mm.

The bosses. The M3 insert is 5.7 mm long and Ø4.6; its hole is 4.0 mm, at least 6.7 deep (insert + 1). You need at least 1.6 mm of wall around the hole, so the boss is at least 4.0 + 2 × 1.6 = 7.2 mm. You take 8. The lid bosses stop 0.2 mm short of the base bosses. Lid hole: 3.4 mm (M3, medium series), with your printer's hole compensation.

The screw. With its head bearing on the top face, it passes through the lid's 12 mm and the 0.2 gap before entering the insert, which sits at the top of the base boss. It travels 12.2 mm to the insert, so an M3 × 16 leaves about 4 mm of thread inside. If the lid has a counterbored head, measure the real length in your model.

The print. The base on its floor; the lid on its top face, with the 0.5 chamfer on the bed edge. Seams at a back corner, away from the loaded side of the bosses. Enough walls (perimeters) to fill the 2.4 mm, and 4 walls around each boss hole: with 3 lines of 0.45 mm you only get about 1.3 mm, under the minimum (Designing for heat-set inserts).

The check before printing. Do two features locate the lid at once? No: the bosses do not touch. Skin ≥ 1.2? Yes. Z gap ≥ one layer? Yes. Wall around the hole ≥ 1.6? Yes, at Ø8.

Variant: sliding lid with detent. A 1.6 mm PETG lid. The tongue is in the lid (length in the layer plane, flex in Z): thickness t = 1.6, width w = 6, a 0.5 mm bump (the tongue's deflection y) and length L = 10 mm. The strain at the root comes to 1.2 %, inside the 2 % PETG allows in repeated use; in PLA, at 1 %, the same tongue needs L ≥ 11 mm (the formulas are in Print-friendly snap fits). Lifting the bump takes about 4.9 N with E = 1.6 GPa along the beads. With friction μ = 0.3, a 30° ramp needs about 5.2 N to open, a soft click; at 45°, about 9 N, a firm one. Root radius ≈ 0.5 t = 0.8 mm.

That E assumes beads running along the tongue, and a 1.6 mm lid is all solid layers, which the slicer alternates at ±45°. Put a modifier over the tongue with the solid infill direction and the top and bottom layer directions along it (in OrcaSlicer, as of late 2026, these are modifier settings) and check it in the preview. Without it, the force comes out lower than calculated and the root flexes across the beads.

When it fails

Symptom, cause and fix
Symptom Cause Fix
The lid will not seat, leaving a gap at the rim The lip bottoms out in the rebate (less than one layer of air), the bosses touch before the rims, or the lid's bed face is warped One layer of air above the lip (in the object, a "Clearance" of at least one layer), bosses 0.2 mm short, chamfer and a first-layer check
Tight at the corners and loose mid-wall, or the other way round Walls bowed by shrinkage; sharp corners in plan Rounded corners, internal ribs, segmented lip
The lid rattles Clearance larger than your printer's sliding clearance, or a friction lid that has already relaxed 0.10 locating fit, crush ribs or positive retention
A friction lid loosens over weeks Creep and relaxation Screws, clips or magnets; do not tighten the fit: the skin cracks
The clip snaps at the root on the first close Arm with its length in Z, rising from the rim of a box printed right way up Horizontal tongue in the wall, or a tongue in the flat lid
The lid pops off when the box is dropped The hooks take the side load; low or missing lip Lip ≥ 3 mm, guides that engage before the hooks
The sliding lid jams halfway Elephant's foot on the lid's land, less than one layer of air in the groove, or bowed walls Slicer compensation and a small chamfer on the land, one layer + 0.2 rounded to layers, a short test length
The sliding lid slides out with the box on its end No detent Tongue with a bump and a 30–45° ramp
The hinged lid jams as it starts to open Axis above the split or inside the back wall's footprint Axis outside the wall, level with the split; if that is impossible, remove or chamfer the back lip and round the edge about the axis
The boss splits when you set the insert Less than 1.6 mm of wall around the hole, seam on the loaded side Ø8 boss for M3, 4 walls, seam elsewhere (Designing for heat-set inserts)
A step shows along the split Side play (±c) Reveal on both edges

How to test it

Do not print the whole box to test the lip. Print only the top 10 mm of the base and the bottom 10 mm of the lid: two frames, about 30–40 minutes. They check the lip clearance, the Z gap and how the corners fit over the real wall length (Test coupons).

With the full box, close and open it 20 times. Drop it shut from desk height (about 0.75 m) onto a corner, on a hard floor. Turn it upside down and shake it: the retention must hold at least 3 times the weight of the contents, as in Magnets in mechanisms. If the lid holds by friction or clips, measure the opening force again after 48 hours closed and after a hot day (Testing a mechanism before you trust it).

See also

Design it in KapyCAD

Model the joint with these dimensions. Each one stays a value you can change after the first test print.

Free plan, no card. Runs in your browser, nothing to install.

Open the editor

Still have a question?