The guide
A printed enclosure succeeds or fails in the half millimeter where the lid meets the box
A project box is drawn as a solid but printed as stacked lines of plastic, so its walls, posts and lid have to be sized for the nozzle, the layers and the gap between parts.
- 0.86 mm what two 0.45 mm perimeters measure at 0.2 mm layers
- 10 to 73 percent strength of printed ABS bars against molded, by line direction
- 0.1 to 0.3 mm what one makerspace adds to a hole, because holes print small
- 60 C glass transition of PLA on one maker's data sheet
- 64 x 34 x 24 outer size in mm of the worked example case
Read the full guide Fold the guide
Almost every first enclosure has the same fault. The box prints, the board drops in, and the lid will not go on. It is a hair too big, or it rattles, or one corner sits proud. Nothing was drawn wrong. The drawing described a solid, and the printer made a stack of thin lines of molten plastic, each a little wider or narrower than the number on the screen. A case that closes is designed for that process, starting with the walls.
Walls are counted in lines
A fused filament printer does not fill a wall, it traces it. Each pass around the outline is a perimeter. The Slic3r manual recommends at least two, so that where a stretch of one is not printed correctly the second helps cover it. So the useful question about a wall is not how thick it is but how many lines fit inside it. A wall that holds a whole number of lines prints clean. One that holds three and a half leaves a gap or an overlap.
The arithmetic is not quite multiplication. Take lines 0.45 mm wide: two perimeters do not make 0.90 mm. The same manual gives the reason. The slicer treats each line as a rectangle with semicircular ends and overlaps neighbors slightly so that they bond, which puts two lines closer together than their width: the spacing is the extrusion width less the layer height times (1 - pi/4). At a 0.2 mm layer height that comes to 0.407 mm, so two perimeters measure 0.45 + 0.407 = 0.86 mm. Work the same sum for the number of perimeters wanted, and take the result back to the drawing.
The concern is older than desktop printers. In 2002 Sung-Hoon Ahn and four co-authors tested ABS parts from a Stratasys machine, with bead width among the settings they varied, and drew up build rules for designers from the results.
Slicers turn this into round numbers. Cura’s base profile starts its wall thickness at 0.8 mm and its line width at 0.4 mm, and says the first divided by the second gives the number of walls: two perimeters. A box that will be handled wants more than a slicer’s starting point, and the generator on this page starts at 2 mm. Four 0.45 mm lines come to 1.8 mm before any overlap, so a 2 mm wall is four perimeters with a little to spare.
A stack of layers has a grain
Ahn’s bars are the reason to care which way a part is printed. With the lines running along the pull, the bars were at their strongest. With the lines running across it, so that only the bonds between neighbors carried the load, they were at their weakest. Across the four layouts tested, strength ran from 10 to 73 percent of the molded material. The practical patterns, crisscrossed and pressed slightly into each other, managed 65 to 72 percent. In compression the printed bars did better, at 80 to 90 percent.
The same weakness runs between layers. A study of printed PLA found poor adhesion between the layers farthest from the heated plate, where the stiffness measured was 220 MPa against 500 in the middle of the piece. Its authors concluded that the melt has to diffuse and tangle across each joint before the part is strong. A printed box has a grain, like wood, and it lies flat.
That grain decides how a lid should hold. A snap hook rising from the rim of a box is built straight up, one small layer on another, and it bends across those joints every time the lid comes off. PLA is a poor plastic for the job in any case. One maker’s data sheet puts its elongation under 5 percent, where the same maker’s ASA stretches at least 35 percent before it breaks. A lip that slides inside the walls asks nothing of the layer bonds. Screws do load them, which is why the post matters.
A screw post is the hard case. Driving the screw wedges the hole open, and Ahn’s first rule covers it: when the lines run around a boss, that hoop stress is carried along them, and an upright post is printed as rings. Tightening then pulls the post upward across its layers, the weak way. Thickness is the defense. The generator on this page makes each post three times as wide as its hole, which leaves one hole diameter of plastic all round. That is its own rule of proportion, not a tested limit. A post only a few lines across is all perimeter, with a sharp corner at its root.
What the screw threads into matters as much. The CNC Kitchen guide to inserts describes a screw driven straight into plastic: each assembly deforms the threads a little more, until a ragged hole is left that nothing can grab. A heat-set insert is a brass thread melted into the part with a soldering iron set 10 to 20 degrees above the printing temperature, about 225 C for PLA. A pilot hole is fine for a lid opened twice. A case opened every week has earned brass.
Parts that meet need a gap
Two printed parts drawn to the same size will not go together. The University of Florida’s makerspace explains why: even accurate machines make parts slightly larger or smaller than their drawings, because of how plastic is extruded, cools and stacks.
So the gap is drawn in on purpose. Florida lists 0.15 to 0.20 mm for a snug locating fit, 0.20 to 0.25 mm for a standard sliding fit of the kind used on enclosures, and 0.30 to 0.40 mm for loose covers. Check whether a figure is per side or in total. A lip that leaves 0.2 mm on every side is 0.4 mm narrower than its opening.
Holes need their own correction, because they come out small. The Slic3r manual calls that the usual complaint about horizontal dimensions and gives the reasons: plastic shrinks as it cools, more material is laid on the inside of a curve than the outside, and a round hole is sliced as a polygon. It adds that a hole too small is the better mistake, since it can be drilled. Cura has a setting, Hole Horizontal Expansion, that widens every hole by a chosen amount.
The generator here starts a quarter millimeter either side of the screw: 0.25 mm over its diameter where the screw must pass, the same figure that tops Florida’s sliding fit, and 0.25 mm under where it must bite. For a 3 mm screw that is a 2.75 mm hole. A machinist cutting a thread would drill smaller. A tap drill is roughly the screw’s diameter less its pitch, and the coarse pitch of a 3 mm metric thread is 0.5 mm, which gives 2.5 mm. The quarter millimeter is a starting point, not a standard. Where the size really matters, print small and drill.
Then there is the first layer. It is pressed against the heated bed so that the print will stick, and it spreads. Cura’s definition file calls the result an elephant’s foot: a flare that sticks out beyond the drawn size and gets in the way of assembly. There are two cures. The slicer can pull the first layer in. Cura’s setting for it, Initial Layer Horizontal Expansion, takes a negative value to make up for the squash, and its default is zero, so the amount is left to a test print. Or the designer can put a 45 degree chamfer or a radius on every edge that touches the bed.
Orientation is a third cure, and it is free. A lid printed flat, lip up, keeps the flare on its outside face, where nothing has to fit. Lip down, the flare lands on the surface that must enter the box.
One small board, worked through
Take a Raspberry Pi Pico. Its datasheet gives a board 51 by 21 mm and 1 mm thick, with four 2.1 mm mounting holes: 11.4 mm apart across the board and 2 mm in from each end, so 47 mm apart along it. Half a millimeter of room all round would make the smallest cavity 52 by 22 mm. That leaves nothing for a plug or for fingers, so call the inside 60 by 30 by 20 mm. With 2 mm walls and a 2 mm floor and lid, the outside comes to 64 x 34 x 24 mm.
The board sits on four standoffs 5 mm tall, set on that 47 by 11.4 mm pattern. A 2 mm screw should bite, so each hole is 1.75 mm, and a 5.5 mm standoff leaves a little more than one hole diameter of plastic around it. The lid is a plain lip with 0.2 mm of gap per side. One 12 mm hole in the end wall, centered 8 mm above the floor, passes the cable with room to spare, and five slots in each long wall finish it. A generator given these numbers reports 11.5 cubic centimeters of plastic in the box and 5.3 in the lid.
At 1.24 grams per cubic centimeter, the figure on one PLA data sheet, that is about 21 g of solid plastic. A slicer uses less wherever a section is thick enough for infill. It is a ceiling, not a forecast.
Warm air, soft plastic and a file with no units
A closed box keeps heat in, and electronics make heat. Raspberry Pi’s documentation says its single-board computers start to throttle the processor between 80 and 85 C. One filament maker’s data sheet for PLA gives a glass transition temperature of 60 C and a heat distortion temperature of 55 C, so the plastic softens well below the point where the processor slows itself down. Slots in the walls give warm air a way out, and upright slots print cleanly. The top of a 2 mm slot is a bridge only five nozzle widths long, and how far a bridge can span depends, the Slic3r manual says, on the material and cooling.
If the case will live somewhere warm or outdoors, change the plastic rather than the vents. The same maker’s data sheets list a heat deflection temperature of 70 C for its PETG and 86 C for its ASA, against the 55 C of its PLA. Sunlight is a separate question. A study published in 2026 aged printed PLA under ultraviolet light and humidity for up to 2,000 hours and found a significant loss of tensile strength.
ASA was developed as an alternative to ABS with better resistance to weather, and it is used in printing for its resistance to ultraviolet light, particularly outdoors. An encyclopedia entry credits it with about ten times the resistance of ABS to weathering and ultraviolet radiation. It asks more of the printer: its maker’s sheet recommends a closed chamber for larger prints. The same file prints in all three.
That file is simpler than most people expect. STL was first documented by 3D Systems in 1988, according to the Library of Congress, and it describes a surface as triangles and nothing else: for each one, three corners and a normal pointing outward. The binary form is an 80 character header, a count, and 50 bytes per triangle. There are no units. A classic description of the format says the coordinates are in arbitrary units, which is why a makerspace has to state that it wants millimeters. And every triangle must share two corners with each of its neighbors.
So an STL holds no circles, no walls and no standoffs, only facets. A hole is a ring of flat faces, and nothing in the file says it was meant to be round or 12 mm wide. This is the trade a generator makes. OpenSCAD describes itself as something like a 3D compiler rather than an interactive modeller: a script goes in, and designs are defined by configurable parameters. A box generator is the same idea with the script hidden. Change one number and the whole part is rebuilt to match, which a hand-edited mesh never is.
What it cannot do is leave its family of shapes. A generator of this kind makes a straight-walled box with a flat lid, round posts, one round hole and rows of slots. It will not cut a rectangular window for a display, shape a wall around an odd connector, add ribs or seal against water. It does not know the height of the tallest part on the board. It does not test strength: it checks that the pieces fit inside one another, not that a post survives a dropped case. And it cannot know the printer.
So print the lid first, or a thin slice of box and lid, and try the fit. Florida’s makerspace says tolerances are learned by doing. The drawing is a proposal. The half millimeter is settled at the printer.
Sources
Every source consulted for this guide. Links checked October 7, 2026.
- Fused Filament Deposition of PLA: The Role of Interlayer Adhesion in the Mechanical Performances Liparoti, Sofia, Romano, Marra and Pantani, Polymers (Basel), 2021, via PubMed Central
- Temporal evolution of structure property relationship for UV+RH artificially weathered material extrusion additive manufactured PLA Faizaan and others, Scientific Reports, 2026, via PubMed Central
- ISO metric screw thread Wikipedia
- Print Settings Slic3r Manual
- Flow Math Slic3r Manual
- FDM Printer Base Description (fdmprinter.def.json) UltiMaker, Cura repository on GitHub
- Technical Data Sheet: The Filament PETG Spectrum Filaments
- Technical Data Sheet: ASA 275 Spectrum Filaments
- Acrylonitrile styrene acrylate Wikipedia
- Anisotropic material properties of fused deposition modeling ABS OpenAlex catalogue record W1978568424 (Sung-Hoon Ahn, Michael Montero, Dan Odell, Shad Roundy and Paul Kenneth Wright, Rapid Prototyping Journal, vol. 8, no. 4, pages 248 to 257, 2002)
- Designing for 3D Printing Tolerances on the MK4 and XL Marston Makerspace, University of Florida Libraries
- Dimension Errors Slic3r Manual
- Tips & Tricks for Heat-Set Inserts used in 3D printing | CNC Kitchen CNC Kitchen
- Raspberry Pi Pico Datasheet Raspberry Pi Ltd
- Raspberry Pi computer hardware - Raspberry Pi Documentation Raspberry Pi Ltd, copy held by the Internet Archive
- Technical Data Sheet: The Filament PLA Spectrum Filaments
- STL (STereoLithography) File Format Family Library of Congress, Sustainability of Digital Formats
- STL (STereoLithography) File Format, Binary Library of Congress, Sustainability of Digital Formats
- The StL Format | fabbers.com Ennex Research, reprinted from Automated Fabrication by Marshall Burns
- OpenSCAD - About OpenSCAD