How to embed magnets and nuts in a 3D print: pocket size and the layer to pause at
A nut or a magnet sealed inside a print can’t fall out and needs no glue. It takes two numbers: a pocket that fits, and the right layer to pause at. Here are both, and the reason guides online are so often one layer apart.
Short answer
Make each pocket the part’s size plus a small clearance (the test block tries +0.10, +0.20 and +0.30 mm), end it on a layer boundary with air above the part, and pause before the first layer that covers it. Checked in the Loftsmith engine at 0.20 mm layers: the pockets stay open to Z 4.40 (layer 22), so mark layer 23 in PrusaSlicer or Bambu Studio, or enter 22 in Cura 5.14’s Pause at Height (check the number in the preview on older versions).
Sealing a nut or a magnet inside a print is simple in principle. You leave a pocket, pause the printer before the layer that would close it, drop the part in, and let the printer roof it over. In practice two numbers decide whether it works: how big the pocket is, and which layer you pause at. Get the first wrong and the part rattles or won’t go in. Get the second wrong and the nozzle hits the part, or prints the roof over an empty hole.
Most guides online give one worked example at most, and they disagree about which layer to mark. This one gives the rule, the reason they disagree, and a full worked example from a test block checked in the Loftsmith engine on 9 November 2026: M3 nuts and 8 × 3 mm magnets under one pause, with the roof checked over both. Nothing in it has been printed yet, and the guide says so where it matters.
Which layer to pause at, and why guides disagree
The pause goes between two layers: the last one that leaves every pocket open, and the first one that prints over it. Slicers number layers from the bed up, with the first layer usually a different height from the rest, so the arithmetic is:
last open layer = 1 + (pocket top − first layer) ÷ layer height · pause before the next layer
Pocket top is the Z where the pocket ends, which should sit on a layer boundary. With a 0.20 mm first layer and 0.20 mm layers, a pocket open to Z 4.40 gives last open layer 1 + (4.40 − 0.20) ÷ 0.20 = 22, so you pause before layer 23.
The engine states the same thing for the test block at its defaults:
What you type into the slicer depends on which slicer it is, and this is where the published advice splits:
| Slicer | What you mark | In this example | Pause command | Source |
|---|---|---|---|---|
| PrusaSlicer | The first covering layer: the pause is inserted before the layer you select | Layer 23 (Z 4.60) | M601 on Prusa printers (the MK3 family needs firmware 3.9.1 or later); other printers’ profiles may send something else | Prusa Knowledge Base |
| Bambu Studio | The first covering layer: the printer stops before printing it | Layer 23 (Z 4.60) | M400 U1, from Bambu’s machine profiles | ozfdm walkthrough; Bambu profile |
| Cura 5.14, Pause at Height, by layer | The last open layer: the setting is “Pause at End of layer(s)”, numbered as in Cura’s preview | 22 | Selectable; the default is M0 with a message (Marlin) | Cura’s script |
| Cura 5.14, Pause at Height, by height | A height: it pauses at the start of the first layer at or above it | More than 4.40, up to 4.60 | As above | Cura’s script |
That split explains most of the contradictions online. Advice written for Cura, to enter the last open layer, is one layer off when it is followed in PrusaSlicer or Bambu Studio, and the other way round. DPHacks (November 2025) says to move the marker to the layer that covers the magnet and calls stepping back one layer a mistake. Draftid’s Bambu Studio tutorial (6 October 2026) says to step back one layer. Since Bambu Studio pauses before the layer you mark, that stops one layer early. It still works when the part sits below that layer, as it does in Draftid’s own pockets (2.4–2.5 mm deep for a 2 mm magnet), and risks a nozzle strike when it doesn’t.
LayerCraftLog (1 June 2026, still live on 9 November) gives an M3 example of pausing at “layer N+6” with 0.2 mm layers, 1.2 mm in, for a 2.5 mm deep cavity. Read as written, that pause comes about halfway up the pocket, and a nut dropped in then would stand proud of the layers still to print.
Whatever your slicer, check the preview before you print. Step to the layer before the pause: the pocket should be open and at full depth. Step one layer up: the roof should start there.
Pocket size: nuts across flats, magnets by diameter
Hex nuts
Size a nut pocket by the width across the flats, not across the corners, and start from the standard’s maximum: no nut that meets the standard is bigger, so a pocket built on it fits every compliant nut. The test block adds its clearance steps (+0.10, +0.20, +0.30 mm at the defaults) to that width.
| Nut | Across flats (max) | Height (max) | Pocket +0.10 | Pocket +0.20 | Pocket +0.30 |
|---|---|---|---|---|---|
| M3 | 5.5 mm | 2.4 mm | 5.60 mm | 5.70 mm | 5.80 mm |
| M4 | 7 mm | 3.2 mm | 7.10 mm | 7.20 mm | 7.30 mm |
| M5 | 8 mm | 4.7 mm | 8.10 mm | 8.20 mm | 8.30 mm |
| M6 | 10 mm | 5.2 mm | 10.10 mm | 10.20 mm | 10.30 mm |
| M8 | 13 mm | 6.8 mm | 13.10 mm | 13.20 mm | 13.30 mm |
The nut trap sizes in the screw hole guide use the nut plus 0.3 mm (5.8 mm for M3). That is for a nut pushed in after printing, where a little play makes assembly easier. A nut you seal in can be closer, because nothing has to slide.
Round magnets
Published magnet pockets agree on the shape of the answer, a tenth or two over the magnet, and differ in the detail:
| Source | Press fit | Glued | Sealed in mid-print | Notes |
|---|---|---|---|---|
| Total Element | +0.10–0.15 mm (6.10–6.15 mm) | +0.2–0.3 mm (6.2–6.3 mm) | +0.2 mm, 0.2 mm deeper | 2 to 4 layers on top; says most FDM printers print holes slightly small |
| ozfdm | +0.1 mm | +0.2 mm | +0.3 mm, 0.2 mm deeper | Its 6 × 3 example: 6.1, 6.2 and 6.3 mm |
| Draftid | 6.2 mm | 6.3 mm | Not given | A loose magnet in a 6.3 mm hole was lifted out by the hot end |
| DPHacks | Not given | Not given | +0.1 mm (5 × 2 magnets) | Magnet 0.4 mm below the top surface |
| Loftsmith test block | Not used | Not used | +0.10, +0.20, +0.30 mm ladder | 8 × 3 mm defaults: 8.10 / 8.20 / 8.30 mm |
Two reasons they differ. Printed holes come out small by an amount that changes from printer to printer (the guide to 3D printing tolerances explains why). And the magnets vary too: supermagnete sells its 6 × 2 mm and 8 × 3 mm discs at ±0.1 mm, and K&J Magnetics gives the same tolerance. That is the same size as the steps people argue about, which is the best reason to print a ladder with magnets from your own batch.
Reading the ladder
Once the print is finished the roof holds the part. Until then it has to stay put on its own while the first roof layer goes over it, and that decides the pick differently for nuts and magnets:
- Nuts: take the smallest pocket the nut drops into and lies flat in. Steel isn’t pulled toward the nozzle, so it only has to sit level and not tip.
- Magnets: take the tightest step the magnet seats in with a light push, or a drop-in step plus a small drop of CA (super) glue. A magnet that sits loose can jump to the steel nozzle as it passes: Prusa’s knowledge base warns about exactly that and suggests a tight slot or super glue, and Total Element suggests a tiny dab of glue for the same reason.
Mixing nuts and magnets under one pause
A nut and a magnet are rarely the same height, and every extra pause is another trip to the printer. The test block solves it by giving each pocket its own floor, so every part tops out at the same Z and one pause covers them all:
| Part | Height | Floor | Top | Air under the roof | Nozzle on layer 23 |
|---|---|---|---|---|---|
| M3 nut | 2.4 mm | 1.80 mm | Z 4.20 | 0.20 mm | 0.40 mm above it |
| 8 × 3 mm magnet | 3 mm | 1.20 mm | Z 4.20 | 0.20 mm | 0.40 mm above it |
floor = pocket top − air gap − part height
Why leave 0.20 mm of air? Because a part that sits a little proud, on a crumb or a high corner, would otherwise be hit by the first roof layer. With the gap, the nozzle passes 0.40 mm above the part. That is what the check measures, not a promise about every printer. For comparison, MLC CAD leaves 0.3 mm between the nut and the first roof layer for the same reason, and HydraRaptor’s 2014 example set the nut flush with a layer boundary and relied on the next 0.4 mm layer for clearance.
The engine also checks that the parts can go in. At the pause, every pocket is open from above: a straight 20 mm drop of each part clears the printed block (0.00 mm³ overlap), and each of the 6 parts was checked at 8 poses along its path in.
The roof: bridging over hardware, and how much it must overlap
The first roof layer is printed over the pocket with nothing directly under it, so it is a bridge. Here it prints 0.20 mm above the hardware and bridges at most 0.17 mm past its edges: almost all of the span has metal a fraction of a millimetre below, so any droop lands on the part instead of falling into the pocket.
The engine’s print check flags 216 mm² (3.1%) of the block as overhanging. On a flat-sided block, those downward faces are the pocket ceilings, the short bridges just described, and the report estimates about 0 g of support. Turn supports off for this print: support inside a pocket would block the hardware. The guide to overhangs and bridges covers why short, anchored bridges print cleanly.
Over a nut: keep the bolt hole, keep the overlap
A nut needs a bolt hole through the roof and the floor, and which of the two carries the load depends on where the bolt comes in. A bolt entering through the roof pulls the nut up against the roof, so the roof’s overlap round the hole holds it. A bolt entering through the floor, as on the test block, pulls the nut down onto the floor, which then takes the load. The test block uses the 3.4 mm M3 clearance hole in both, which leaves a 1.05 mm ring of roof over each side of the nut, and a 3 mm bolt passes through the floor, the nut and the roof with 0.00 mm³ of overlap.
roof overlap per side = (nut across flats − bolt hole) ÷ 2
Over a magnet: close it
A magnet needs no hole, and a hole only weakens the cover. The test block’s roof is solid over 100% of each magnet face, 1.60 mm thick (8 layers). The first version of the model left the 3.4 mm nut hole over the magnets too; the reviewer caught it, and the hole now follows the hardware.
Every layer over a magnet costs pull. supermagnete’s FAQ says a gap of 0.5 mm can halve the adhesive force, and K&J Magnetics measured a 1/2 × 1/8 in disc at 6.44 lb on a steel plate and 3 lb with about 0.03 in (about 0.8 mm) of paper between. The test block puts 1.80 mm of air and plastic over the magnet and 1.20 mm of floor under it, which is fine for a fit test. For a part that has to grip, keep thin whichever side faces the other magnet or the steel: the roof for a magnet in a lid that closes onto something, the floor for a magnet in a Gridfinity bin base, which grips the baseplate below it. Total Element suggests 2 to 4 layers over a magnet. Nobody we found publishes a pull figure for a 1.60 mm cover on these sizes, so we don’t give one.
At the pause: polarity, glue and the nozzle
- Mark the polarity first. Two magnets only attract with opposite poles facing. Mark one face of every magnet against a reference magnet before the print starts, so you aren’t working it out with the bed cooling (ozfdm gives the same advice).
- Seat every part firmly. Prusa’s knowledge base warns that magnets must sit firmly in their slots, “Otherwise, they’ll get stuck to the print head as it passes over them”, and suggests a tight slot or a small drop of super glue. Draftid saw it happen in a 6.3 mm hole, and Total Element suggests a tiny dab of glue for the same reason. Nuts can’t jump, but push each one flat onto its floor.
- Don’t move the print. Insert from above with tweezers and keep your hands off the part itself, then resume.
- Heat. Standard N-grade neodymium magnets are rated to 80 °C by both supermagnete and K&J, and Bambu Studio’s base PLA profile heats a smooth or textured plate to 55 °C. Nobody we found measures how hot a magnet gets as the nozzle passes over it, so for high-temperature filaments check your magnet’s rating.
| Disc | Tolerance | Adhesive force | Max working temperature | Source |
|---|---|---|---|---|
| 6 × 2 mm | ±0.1 mm | about 740 g | 80 °C | supermagnete |
| 8 × 3 mm | ±0.1 mm | about 1.5 kg | 80 °C | supermagnete |
Seal it in, press it in, or use a heat-set insert
| Method | What holds it | What it needs | Can it come out? |
|---|---|---|---|
| Sealed in mid-print | The printed roof | You at the printer for the pause | No, short of cutting the part |
| Pressed or glued in after printing | Friction, or glue | No pause; a tight pocket or glue | Yes, if it loosens |
| Nut trap with a side slot | The slot’s walls and the bolt | No pause | It slides out the way it went in until the bolt is in |
| Heat-set insert | Plastic melted into the knurls | A soldering iron | No |
Sealing in needs no glue and no tools, and the part can’t come out, which suits magnets in lids and nuts in clamps. The cost is that you have to be there for the pause. For threads you’ll undo often, a nut pressed in from the side (sizes in the screw hole guide above) or a heat-set insert does the same job without a pause: the heat-set insert hole size chart has the maker’s hole for each size, and the insert tester finds the hole your printer needs.
Heat-set insert testerFive insert holes around the catalog size, M2 to M5, for when a heat-set insert suits the joint better than a sealed nut.60 × 16 × 9 mm · 5 g · 11 minGridfinity bins use 6 × 2 mm magnets (the other numbers are in the Gridfinity dimensions guide). The test block’s magnet sliders run 3–20 mm in diameter and 1–6 mm in height, so set them to 6 and 2 and the model states the pause layer for your layer height. We haven’t published a 6 × 2 build, only the slider ends, so read the number off your own build.
What the test block costs, and what we didn’t check
The block is 55 × 43.4 × 6 mm, about 11 g and 16 minutes in PLA at 2 walls and 15% infill, and 19 g and 27 minutes at 4 walls and 25%, by the engine’s estimate on the Bambu Lab A1. At the largest clearance the walls between pockets are 4.6 mm between rows and 10.7 mm between columns, with 4.3 mm at the sides. The model puts the roof on a second filament (about 4 g of the total), so you can swap colour at the pause and see at a glance where it fell.
| Setting | Filament | Time |
|---|---|---|
| 2 walls, 15% infill | 11 g | 16 min |
| 3 walls, 15% infill | 15 g | 22 min |
| 3 walls, 20% infill | 15 g | 22 min |
| 4 walls, 20% infill | 19 g | 27 min |
| 4 walls, 25% infill | 19 g | 27 min |
Every slider was rebuilt at both ends, and each build passed every check: nut sizes M4, M5, M6 and M8; the magnet row off; magnets 3 and 20 mm across and 1 and 6 mm tall; the 608 bearing row on; layer heights 0.08 and 0.32 mm; first layers 0.1 and 0.35 mm; smallest clearance 0.05 and 0.3 mm and step 0.05 and 0.25 mm. That is each slider at its ends, not every combination.
The model went through 3 rounds of Loftsmith’s Workshop review before it was published. Besides the magnet roof, the reviewer had the bolt line fixed (a bolt couldn’t pass through until the 3.4 mm hole was added to the floor), had “every combination checked” cut back to “each slider checked at both ends”, had gram figures for M8 and 608 builds that hadn’t been run removed, and had the check “Roof lands on the hardware” renamed “Roof bridges over the hardware”, because the roof prints over air.
Tolerance testerA peg-and-hole ladder from 0.1 to 0.5 mm, for the fits around the hardware rather than the hardware itself.71 × 35 × 10 mm · 5 g · 21 minThe test block is a free Workshop model: open the nut and magnet pocket test, pick your nut, magnet and layer height, and the engine rebuilds it and states the pause layer.
How these numbers were made
Written by the Loftsmith team. The pocket, floor, roof and pause figures come from the Loftsmith engine’s build report of 9 November 2026 for the test block (Bambu Lab A1 profile, PLA, default sliders: M3 nuts, 8 × 3 mm magnets, 0.20 mm layers, 0.20 mm first layer, smallest clearance 0.10 mm, step 0.10 mm). The report holds 17 checks, all passed, and 18 rebuilds at the slider ends, all of which built and passed. We couldn’t rebuild it at other layer heights for this guide, so the worked example stays at the defaults and the formula covers the rest.
Nut sizes come from the engine’s hardware catalog and ISO 4032. Slicer behaviour comes from Prusa’s documentation, Bambu Studio’s profiles and Cura’s script source; magnet tolerances, temperatures and pull from supermagnete and K&J Magnetics; other guides’ advice from the pages linked where it is quoted, read on 9 November 2026.
Not tested: nothing in this guide has been printed or measured. When it has, the results will go here.
Questions people ask
Which layer do I pause at to embed a magnet?
Between the last layer that leaves the pocket open and the first one that covers it. PrusaSlicer and Bambu Studio pause before the layer you mark, so mark the first covering layer; Cura’s Pause at Height script, by layer, asks for the last layer to finish. In the Loftsmith engine’s example at 0.20 mm layers the pockets stay open to Z 4.40: mark layer 23 in PrusaSlicer or Bambu Studio, or enter 22 in Cura 5.14 (on older Cura versions, check the number against the preview).
What size hole for a 6 × 2 mm magnet?
Published figures run from about 6.1 mm for a press fit to 6.3 mm for a glued or sealed-in magnet (Total Element, ozfdm, Draftid), and the magnets themselves are made to ±0.1 mm. Print a ladder with your own magnets: the Loftsmith test block steps the pocket +0.10, +0.20, +0.30 mm over the magnet. For a magnet you seal in, take the tightest pocket it seats in with a light push, or a drop-in pocket with a small drop of CA glue, so the nozzle can’t lift it while the first roof layer goes over.
How big should the pocket be for an embedded M3 nut?
An M3 nut is at most 5.5 mm across the flats and 2.4 mm thick (ISO 4032). The Loftsmith test block tries 5.60, 5.70, 5.80 mm across the flats, sets the nut on a 1.80 mm floor so its top is 0.20 mm under the roof, and keeps a 3.4 mm bolt hole in the roof, which leaves 1.05 mm of roof over each side of the nut. Checked in the engine, not yet printed.
Can the nozzle pull a magnet out of its pocket?
Yes, if it is loose. Prusa’s knowledge base warns that magnets not firmly in their slots can stick to the print head as it passes over them, and suggests a tight slot or a small drop of super glue. The engine example also leaves 0.20 mm of air above each part, so the nozzle passes 0.40 mm above it on the first roof layer.
Does covering a magnet with plastic weaken it?
It weakens the pull through the cover. supermagnete says a gap of 0.5 mm can halve a magnet’s adhesive force. The Loftsmith test block puts 1.80 mm of air and plastic over each magnet, which is fine for a fit test; for a magnet that must grip through its cover, use a thinner roof (Total Element suggests 2 to 4 layers). We found no published pull figure for a 1.60 mm cover.
Will a heated bed demagnetise neodymium magnets?
Standard N-grade magnets are rated to 80 °C by supermagnete and K&J Magnetics, above the 55 °C plate in Bambu Studio’s base PLA profile. Nobody we found measures how hot a magnet gets as the nozzle passes over it, so check your magnet’s rating before using a high-temperature filament.
Sources and method
Written by the Loftsmith team. Pocket, floor, roof and pause-layer figures come from the Loftsmith engine’s build report of 9 November 2026 for the nut and magnet pocket test (Bambu Lab A1 profile, PLA, default sliders), read from the report in code: 17 checks, all passed, and 18 rebuilds at the slider ends, all passed.
Nut sizes come from the engine’s hardware catalog and ISO 4032; slicer behaviour from Prusa’s documentation, Bambu Studio’s profiles and Cura’s script source; magnet data from supermagnete and K&J Magnetics. Other guides’ advice is quoted from the pages listed below, read on 9 November 2026.
Not tested: nothing in this guide has been printed, pull-tested or measured, and no pause layer is given for layer heights other than the default, because the model wasn’t rebuilt at them for this guide.
Found a mistake? Email [email protected] and we’ll fix it.
- Prusa Knowledge Base: Insert pause or custom G-code at layer
- UltiMaker Cura 5.14 PauseAtHeight.py
- Bambu Studio common machine profile (machine_pause_gcode)
- fasteners.eu: ISO 4032 hex nut dimensions
- supermagnete: disc magnet 6 × 2 mm (S-06-02-N)
- supermagnete: disc magnet 8 × 3 mm (S-08-03-N)
- supermagnete FAQ: what affects adhesive force
- K&J Magnetics: neodymium magnet specifications
- K&J Magnetics: how much will a magnet hold?
- Bambu Studio base PLA profile
- UltiMaker Cura 5.14.0 release notes
- Total Element: magnet pocket clearance for 3D prints
- Total Element: how to embed magnets in 3D prints
- ozfdm: embedding magnets in 3D prints
- DPHacks: how to add hidden magnets to 3D prints
- Draftid: how to embed magnets in 3D prints
- LayerCraftLog: embedding nuts and bolts in 3D prints
- MLC CAD: how to pause printing to embed hardware
- HydraRaptor: buried nuts and hanging holes
