kapy academy

Embedding magnets and nuts mid-print

15 min readUpdated Nov 2026

You stop the print at a layer, drop a metal part into its pocket, resume, and the next layers seal it inside, with no opening or glue. This is how you hide magnets under a clean face, put a nut in the middle of a thick wall or weight a base with steel balls. The rule: the pocket roof on a layer line, the part below it, and the pause on the bridge layer. It has four costs: someone must be there, the pause leaves a mark, the layer above bonds slightly worse, and whatever goes in never comes out.

The pocket: XY clearance and a roof on a layer boundary

In XY, the part drops in loose, with clearance. You cannot push hard on something still stuck to the bed, and sintered neodymium magnets chip if you force them. For a round magnet, add 0.3 mm to the diameter on an enclosed CoreXY and 0.4 mm on a modern bedslinger: a 6 × 3 mm magnet goes in a 6.3–6.4 mm hole, and a bit more on a legacy bedslinger. For a hex nut, take the width across flats plus 0.2 mm on a modern machine: 5.7 mm for an M3. The roof holds it in; the fit only has to stop it rattling.

A round hole drawn at nominal size will not take the magnet: it prints small because of facets, the bead bulging into the curve and shrinkage (Why holes print small). Clearance by machine class is in Real printed clearances.

Depth is decided in layers. The slicer only works in whole layers: if the roof falls between two, it snaps to the nearest one, which can end up below the top of the metal part. When the print resumes, the nozzle drags whatever sticks up on its first move. The rule is to put the roof on the first layer line at least 0.1 mm above the part. With 0.20 mm layers, the air gap between part and roof ends up between 0.1 and 0.3 mm. A 2.4 mm tall M3 nut needs 2.6 mm; a 4.0 mm nyloc, 4.2 mm; a 3 mm magnet, 3.2 mm.

Think in absolute Z heights from the bed. Put the pocket floor on a layer line too: otherwise the slicer rounds it and the real depth changes by a layer. Even so, the dimension that decides is the roof Z.

Pause pockets with 0.20 mm layers
Part Size XY pocket Depth
6 × 3 mm disc magnet Ø 6, height 3 Ø 6.3–6.4 3.2 mm
M3 nut (ISO 4032) 5.5 across flats, height 2.4 5.7 across flats 2.6 mm
M3 nyloc nut 5.5 across flats, height 4.0 5.7 across flats 4.2 mm
General rule diameter d or across flats s, height h d + 0.3–0.4 (magnet), s + 0.2 (nut) first layer line ≥ h + 0.1

A layer boundary is the first layer height plus a whole number of layers, measured from the bed. With a 0.20 mm first layer and 0.20 mm layers, any multiple of 0.2 works. Turn off variable (adaptive) layer height on that part, because it moves the layer boundaries. A height range modifier that changes layer height has the same effect (Modifiers by region and height).

Orient the pocket with its mouth up and its walls vertical. Vertical walls stack bead on bead and hold their size; the only unsupported surface is the roof.

If you put several magnets close together, they attract each other while you place them and pull one another out of their pockets. Space them several diameters apart or accept that you will have to glue them.

PauseDepth to the layer lineRoof layers0.20 mm layersPart height hBridge layerMargin 0.1–0.3NozzleSticks upXY clearanceBed6 × 3 magnetM3 nut
The pocket roof falls exactly on a layer line, the part sits a few tenths below it, and the pause comes before the bridge layer. If the nut sticks up, the nozzle hits it on resume.

The roof: the layer that closes it

The slicer does not know there is a magnet. It sees a hole and prints the first layer over it as a bridge, with bridge speed, flow and fan (Overhang and bridge settings). The strands anchor on the pocket walls, not on the metal part: plastic does not stick to nickel or steel.

That is why you keep the air gap over the part to a few tenths of a millimeter, never two layers. A strand that sags comes to rest on the part, a fraction of a millimeter below, instead of hanging in mid-air. So even the roof over the 22 mm pocket of a 608 bearing comes out flat, even though 22 mm is past the roughly 20 mm a modern machine bridges cleanly.

The roof takes at least 3 layers (0.6 mm with 0.20 mm layers) over a small pocket, and 4–5 layers once the span passes about 10 mm: the first bridge layer comes out rough and the ones above have to cover it (a rule of thumb, not a measured value). If the roof is a visible face, add the top layers your profile uses on top.

With magnets, the roof adds to the air gap. Every tenth of a millimeter of plastic costs a disproportionate share of the pull, and in a latch the roofs of both halves add up. Use the thinnest roof that comes out flat; the force-versus-gap curve is in Magnets in mechanisms.

If the nut is going to take a screw, the closing layer has to leave room for it, and strands ending at the edge of the hole have nothing to anchor on. There are two ways round it. One is a single-layer membrane over the hole, which you pierce afterwards with the screw or a drill. The other is the two-layer sacrificial bridge: a slot first and a square on top, each layer resting on the one below. The geometry is in Captive nuts and clearance holes and Designing out supports.

For a bearing, cover only the outer race. Draw the roof as a ring with an opening clearly wider than the inner race, so the plastic touches neither that race nor the shields. Depth follows the same rule, with the bearing width as h. The pause gives axial retention; radially, the same rule: it drops in loose. A bearing that needs a press fit goes in after the part is printed, never during a pause.

MagnetBridge strandsNut with screwSingle-layer membranePierced afterwardsBearingOuter raceOpeningInner race free
Three roofs for three parts: solid over a magnet, a membrane over the screw hole that you pierce later, and a ring that covers only the bearing's outer race and leaves the inner one free.

Setting the pause in the slicer

The rule holds in every slicer: find the first layer that covers the pocket in the preview, the bridge layer, and put the pause on that layer. The pause runs before it prints. Then look at the layer below: the pocket must still be open to its full depth there. If the pause has landed one layer too high, that is where you will see it.

PrusaSlicer (since 2.2): right-click the "+" on the layer slider and choose "Add pause print (M601)"; you can type a message for the screen. Prusa documents that the pause comes before the chosen layer and does not work with sequential printing. When you re-slice, the preview shows how long until each pause: use it to be at the printer in time.

Bambu Studio and OrcaSlicer: right-click the layer slider and choose "Add pause". Bambu Studio writes M400 U1 at the start of the layer. Orca inserts whatever is in the "Pause G-code" field of the printer profile: check that it holds a command your machine understands and is not empty or commented out.

Cura: Extensions → Post Processing → Modify G-Code, then add "Pause at Height", by height or by layer number. Pick the method your firmware understands (Marlin M0, BQ M25, RepRap M226, OctoPrint @pause) and check the standby temperature field: if it is 0 or below the printing temperature, the nozzle cools during the pause.

Klipper machines do not understand M601 or M0 without a macro that translates them to PAUSE, and PAUSE needs the [pause_resume] section in the printer config. The Mainsail and Fluidd configs ship the PAUSE macro and the [pause_resume] section, but they do not translate M601 or M0: Klipper answers "Unknown command" and keeps printing, and the nozzle closes the empty pocket. Add a [gcode_macro M601] that calls PAUSE, or put PAUSE straight into the slicer's pause G-code.

Use the pause command, not a filament or color change. On a machine with a filament changer, a color change triggers an unload and a purge you do not want here (Assigning colors in the slicer).

The pause stops the whole plate at that height. If several parts have their roofs at different heights, you need one pause per height, and sequential (object-by-object) printing does not allow pauses (Many parts on one plate).

At the printer: placing the parts and resuming

Each part has to be fully seated and below the rim of the pocket. Run a ruler or a fingernail across the top. A nut or magnet that sticks up is the classic failure: the nozzle hits it on the first move, drags it, or knocks the part off the bed.

Settle the magnets' polarity before printing. Mark a reference magnet and put the same face up in every pocket; if you take them off a stack, they all come off with the same face up. Handle them with plastic or brass tweezers: a magnet sticks to steel ones.

A loose magnet can jump to the head as the nozzle passes. Hardened steel nozzles and the steel parts of the head are ferromagnetic; a brass nozzle and an aluminum block are not attracted. A slightly tighter pocket or a drop of cyanoacrylate keeps it in place.

Do not lean on the part. If you press, you can pop it off the bed and the next layer will print shifted.

Keep the pause short. While it lasts, the last layer cools to bed or chamber temperature, and the next one bonds onto cold plastic. The result is a weaker plane right at the pocket height, because Z strength depends on the temperature at the interface between layers (Layer adhesion and anisotropy). With ABS, ASA or PC in an enclosed printer, opening the door drops the chamber temperature, and the part can warp, lift or crack along that same plane (Warping and lifting corners). Open it as briefly as you can, close it and resume.

Before resuming, wipe off any plastic that has oozed from the nozzle. If the firmware let the hotend cool (some do after a timeout), wait for it to get back to temperature.

You cannot fully avoid the pause mark on the outer walls: put the pocket roof at a height where it does not matter, or accept it. And if the part carries load through the pause plane, orient it so the load runs along the beads rather than across that plane.

Bed heat can demagnetize the magnet

Neodymium magnets lose strength irreversibly above their maximum working temperature. Standard N grades sit around 80 °C, but N50 and N52 top out at about 60–65 °C, depending on the supplier. Suffixed grades last longer: M about 100 °C, H about 120 °C, SH about 150 °C. These are supplier figures for a reference shape, so check the exact grade of yours. A thin disc can tolerate less, and there is no reliable figure for it.

The moment the nozzle passes barely counts; the risk is the hours a few millimeters above a hot bed, sometimes inside a warm chamber that adds its own heat.

Bed temperature against magnet grade
Material Bed N35–N45 (~80 °C) N50–N52 (~60–65 °C) H (~120 °C) SH (~150 °C)
PLA 55–60 °C safe borderline safe safe
PETG 70 °C thin margin exceeds it safe safe
ABS / ASA 90–110 °C exceeds it exceeds it tight safe

You have three options. Move the magnet pockets up the part, away from the bed. Use SH grade with ABS, ASA or PC, and at least H with PETG. Or leave the magnet out of the pause: keep it aside and glue it into a blind pocket afterwards (Seating bearings and bushings).

Nuts and bearings are not affected at these temperatures.

When not to pause

  • Nobody will be at the printer (an overnight print, a print farm): a nut pocket with a side slot (Captive nuts and clearance holes) or a heat-set insert (Designing for heat-set inserts).
  • The part will have to come out one day, like a bearing you will replace: a blind pocket with glue, or a press fit after printing.
  • A press fit that carries load: press it in after printing.

When it fails

Symptom, cause and fix
Symptom Cause Fix
The magnet will not go into the pocket Drawn at nominal size; the hole prints small Ø + 0.3–0.4 mm depending on the machine
The nozzle hits or drags the nut on resume Roof below the part: height not snapped to a layer line, or variable layer height on Roof on the first layer line ≥ h + 0.1; fixed layer height on the part
The printer stops with the pocket already covered Pause set one layer above the bridge layer Pause on the first layer that covers the pocket, checked in the preview
The printer does not stop Empty pause field, or Klipper with no macro for M601 or M0 A [gcode_macro M601] that calls PAUSE, or PAUSE in the pause G-code; try it on the test block
The head unloads and purges filament You used a color change instead of a pause Use the pause command
The roof comes out sunken or rough Two or more layers of air over the part, or a roof under 3 layers An air gap of a few tenths; 4–5 layers on spans over 10 mm
The magnet jumps to the nozzle Loose pocket and a steel nozzle A drop of cyanoacrylate or a slightly tighter pocket
The magnets repel when the latch closes A random face up in each pocket A marked reference magnet and the stack as a dispenser
The magnetic latch barely pulls Thick roofs, or a magnet demagnetized by bed heat Minimum roof; H or SH grade, or a pocket away from the bed
The part breaks along the pause plane Long pause, door left open, or load crossing that plane Short pause, closed chamber, load along the beads

How to test it

The first time on a printer, print a ten-minute test block with a single pocket and the pause set as it will be on the part. Check that the printer really stops, where the head parks, whether the heaters stay on and how it resumes. Drop the metal part in, resume, and run a fingernail across the roof: it has to come out flat, with no sign of the nozzle dragging anything. It is a coupon like any other and follows the same rules.

See also

Design it in KapyCAD

Draw the part with these clearances and walls, and change any dimension later without redrawing it.

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

Open the editor

Still have a question?