Skip to main content

Layer Rescue

CI Release License: MIT

Türkçe

A failed print doesn't always have to go in the bin. Layer Rescue lets your printer pick up a print where it stopped, even after a power cut, and it can put a broken or loose part back on the plate and print the missing part on top of it.

It runs inside Bambu Studio as a post-processing script. You slice as usual, answer a few questions in a small window, and Layer Rescue rewrites the G-code. Before anything reaches the printer, you see the result in Bambu Studio's preview.

A broken rocket drone part repaired with Layer Rescue

A rocket drone body, broken on purpose, put back on the plate and reprinted with its supports. Full test

Watch the Layer Rescue video on YouTube

▶ Watch the full video: how it works, all three modes and every test print, in one go.

What it can do

  • Continue a print that stopped. Filament ran out, the nozzle clogged, you hit stop: tell Layer Rescue the last layer that printed properly, and the job continues from the next one, right on top of the part that is still on the plate. (Test 1)
  • Even after a power cut. After a restart the printer no longer knows where Z is, and homing Z would drive the part into the nozzle. Instead, you lower the nozzle onto the part by hand and Layer Rescue makes every Z move relative to that point. Z is never homed. (Test 2)
  • Put a loose or broken part back and print the rest on it. For a part that came off the plate, broke later or needs an addition. The printer prints a low wall shaped from the part's own outline, pauses so you can put the part in, then prints the missing top onto it. (Test 3, Test 4)
  • Rebuild the supports the new part needs. If the missing top was printed on supports, Layer Rescue prints them again from the bed, even inside a hollow part, and leaves out everything that would get in the part's way. (Test 4)
  • Save what's left of a full plate. If a few parts on a crowded plate came loose, delete them in Bambu Studio and finish the rest. (Test 5)
  • No G-code editing by hand. Bambu Studio keeps its filament mapping and .gcode.3mf data, and the preview shows exactly what will be printed.
  • Careful by default. It never homes Z or levels the bed over a part, checks its own output before saving it, refuses files it can't handle safely instead of guessing, and keeps a backup of the original G-code. The window asks you to confirm what it can't see for itself.
  • English and Turkish, switchable in the window at any time.

Real-world tests

I tested every feature on my own P1S with real prints and wrote down each one step by step, with videos, settings and what I learned. All five worked; two of them taught me something worth knowing before you try it yourself.

The five rescued test prints: rocket drone body, Benchy, spiders, dragon and plane nose cover

All five rescued prints. From left: the rocket drone body, the Benchy, the three spiders, the dragon and the plane's nose cover.

Test Situation What it shows
1. LW-PLA plane part filament jam, printer stayed on the basic resume
2. Dragon power cut resuming after a restart, and what happens when you pick the wrong layer
3. Benchy print came off the plate insert mode, and why parts that get wider towards the top need a bit of hot glue
4. Rocket drone finished part broke insert mode with supports rebuilt from the bed inside a hollow part
5. Spiders 2 of 5 parts came off finishing only the parts that are left, with a seam you can't see

Tested on

Printed with Layer Rescue (the real-world tests above):

  • Bambu Lab P1S, single filament
  • Windows and macOS (Linux from source)
  • Bambu Studio G-code, by-layer printing, relative extrusion
  • The part is still firmly attached to the same plate (resume mode), or it came off / is finished and fits back into a wall printed around it (insert mode, beta)

Every Bambu Lab printer, checked against its own G-code

Bambu Lab printers don't all resume the same way. The P1 and X1 series purge into a chute at the back, the A1 and A1 mini purge off the bed on the left, and the newer H2, P2S, X2D and A2L leave purging, wiping and nozzle selection to firmware commands (G150.x, T<n> H<h>) that differ from model to model. Moves that are right on one printer can be wrong on another, so Layer Rescue has a sequence for each printer instead of one for all.

Each of the 14 printers in Bambu Studio 2.08 (02.08.02.61) was checked the same way:

  1. A real slice. A 3DBenchy was sliced for the printer with Layer Rescue switched off, so the file contained the printer's own, untouched start, filament-change and end G-code.
  2. Bambu's own templates. That G-code was compared line by line with the printer templates in the Bambu Studio source (… machine_start_gcode.json, … change_filament_gcode.json, … machine_end_gcode.json).
  3. The same moves as Bambu. Layer Rescue's sequence for the printer was derived from those: where it purges and wipes, how it selects the filament and nozzle, how it homes X, which command turns the soft endstops off, which extruder gets the temperature. Lines such as the filament selection are copied from your own file, not retyped.
  4. Every mode, many layers. The real file was converted in all three modes (printer stayed on, power cut, insert) at layers from the bottom to the top of the print, and the result was checked: no moves from another printer, every Z move relative after a power cut, nothing printed below the part, and the remaining layers complete.
Printer Sequence Checked against a real slice Printed with Layer Rescue
P1S P1/X1: rear purge chute ✓ ✓
P1P, X1, X1 Carbon, X1E P1/X1: rear purge chute ✓
A1 Off-bed purge at X-48.2 ✓
A1 mini Off-bed purge at X-13.5 ✓
H2D, H2D Pro, H2S, H2C Firmware macros (G150.x), experimental ✓
P2S Firmware macros, experimental ✓
X2D Firmware macros, two nozzles, experimental ✓
A2L Firmware macros on a bed slinger, experimental ✓

A checked G-code is not a printed part. On every printer except the P1S, Layer Rescue still asks you to accept the risks first (CLI: --allow-untested), and the sequences marked experimental rely on firmware commands that Bambu doesn't document. Watch the start of the job, and if you print with it on one of these printers, please share your results: a real print is what moves a printer from the middle column to the right one.

Printers from other brands get the P1/X1 moves after you accept the risks.

Not tested yet: AMS / multi-filament jobs and jobs that use both nozzles of an H2D or X2D. With several filaments Layer Rescue loads the filament that was active at the layer you continue from. By-object printing and spiral vase don't fit the way Layer Rescue works yet, so those jobs are still turned down.

Install

Downloads are on the Releases page.

Windows: run LayerRescue-Setup-<version>-win-x64.exe. The last page of the installer shows the command to paste into Bambu Studio.

macOS (Apple Silicon): unzip LayerRescue-<version>-macos-arm64.zip and move LayerRescue.app to Applications. The app is not signed with an Apple Developer ID yet, so macOS blocks it the first time:

  1. Double-click LayerRescue.app. macOS says it cannot be opened; click Done.
  2. Open System Settings → Privacy & Security, scroll down and click Open Anyway next to Layer Rescue.
  3. The app opens and shows the command to paste into Bambu Studio.

Do this once before using it from Bambu Studio, otherwise Studio cannot start it. Alternatively run xattr -dr com.apple.quarantine /Applications/LayerRescue.app.

Intel Macs, Linux and everything else: install the PyPI package with Python 3.10+ (the window needs Tkinter; with Homebrew Python also run brew install python-tk):

pipx install layer-rescue

Set up Bambu Studio

  1. Switch Bambu Studio to Advanced mode.

  2. In the process settings, open Others and find Post-processing Scripts.

  3. Enter the full path to Layer Rescue, in quotes:

    Install Command
    Windows installer "C:\Users\<you>\AppData\Local\Programs\LayerRescue\LayerRescue.exe"
    macOS app "/Applications/LayerRescue.app/Contents/MacOS/LayerRescue"
    pipx the output of which layer-rescue, e.g. "/Users/<you>/.local/bin/layer-rescue"

    Opening the app directly (without Bambu Studio) shows the exact command for your install.

Studio may show a warning because post-processing scripts are executables. Only approve tools you installed from a source you trust.

Tip: save the process preset with the script in it, so it's there the next time something goes wrong.

The window

After slicing, Layer Rescue opens a small window. At the top it shows the file it got (printer, filament, layer count), and below that there's a tab for each situation:

  • Part is still on the plate: resume an interrupted print (below).
  • Part came off / print on a finished part: insert mode (further below).

The Layer Rescue window on the resume tab

Each tab is a short list of numbered steps. On the resume tab you enter where the print stopped, say whether the printer was turned off, and confirm a few things Layer Rescue can't see for itself under Safety checks. Create G-code stays disabled until everything required is filled in, and the line at the bottom left says what is still missing. Leave G-code unchanged closes the window without touching the file; use it for normal prints.

If the job is for a printer or filament setup that hasn't been tested yet, an extra Untested setup box appears above the tabs. It explains why and asks you to accept the risks before you can continue.

Language: use the English / Türkçe buttons at the top right. The change applies immediately and is remembered for next time. On first start the language follows your system language. (Command-line output stays in English.)

Resume a print

Resuming a plane part after a filament jam

  1. Find the last layer that actually got filament (see Picking the layer below).

  2. Slice the original project again, without changing anything. The Layer Rescue window opens on Part is still on the plate.

  3. Step 1 – Where did the print stop? Enter the last good layer. The window shows the layer and Z height that printing restarts at.

  4. Step 2 – Was the printer turned off or restarted?

    • No, it stayed on the whole time (retained): the printer kept its Z position. Nothing else to do.
    • Yes, it was turned off or restarted (manual): after a power cycle Z is not homed. Heat the bed back up, clean the nozzle, move it over a flat printed area of the last good layer and lower it until it just touches the surface. If the printer offers to home Z, don't accept. Do not move the part or the plate. (Test 2 shows this step by step.)
  5. Step 3 – Safety checks. Layer Rescue cannot see the printer, so you confirm what it has to assume. Tick each box only if it is true:

    • the part is still firmly stuck to the same plate and the plate was not moved;
    • with No, it stayed on: the printer never lost power and the Z axis was not moved;
    • with Yes, it was restarted: you will lower the clean nozzle onto the last good layer before starting the job.

    Only the check for the selected answer in step 2 is shown.

  6. Options can usually stay as they are: nozzle and bed temperature (blank = taken from the file) and homing X/Y before continuing (always on after a restart; Z is never homed).

  7. Click Create G-code, check the preview in Bambu Studio and send the job.

Picking the layer

This is the one decision Layer Rescue can't make for you, and it matters more than anything else. When a print fails, the last few layers are often thin or missing even though the printer counts them as done, so go by the part, not by the counter. If filament ran out at layer 462 but the printer kept going until 490, enter 461. A recording or timelapse helps a lot.

Being off by only 2–3 layers already shows:

  • Printer stayed on: too high leaves a gap, so the seam is weak and very visible; too low drives the nozzle into the part and can knock it off the plate. (Test 1)
  • After a restart: Z comes from where you put the nozzle, so nothing crashes, but the wrong layers get printed there. Too low prints a few layers twice, too high skips them, and the details stop lining up at the seam. (Test 2 is exactly this mistake.)

If you can choose when to stop the print, stop it right after a layer has finished. In Test 5 that gave a seam you can't see at all.

Several objects on the plate

If some parts on a crowded plate came loose, take them off, delete them in Bambu Studio and slice again. Layer Rescue continues everything that is in the G-code, so anything you leave in the project gets printed, in the air if it's no longer on the plate. Don't move, rotate or Arrange the remaining parts; they have to stay exactly where they were printed. (Test 5)

Seat a loose part and print on top (insert mode, beta)

Reseating a Benchy that came off the plate

For a part that came off the plate halfway, a finished part that broke, or a finished part that gets an addition. You slice the complete model (the old part plus what goes on top, one object). Layer Rescue replaces the layers below the part's top with a holding wall that follows the part's outline, pauses, and prints the rest on top of the part you put into the wall.

  1. Prepare the part: remove brim and strings. A broken part must be cut or sanded flat first. Measure its height with calipers.
  2. Slice the complete model. In the Layer Rescue window open Part came off / print on a finished part.
  3. Enter the part height (or the last layer the part contains) and optionally the wall height (blank = recommended: half the part, 3–15 mm, always at least 1 mm below the top). Press Preview to see the wall from above and, under Result, where printing continues and any warnings.
  4. Tick the Safety check (you will stay at the printer, seat the part when it pauses and watch the first layers), click Create G-code and send the job. The printer levels the empty bed, prints the wall, lifts to 15 mm above the part height, parks at the back and pauses (M400 U1).
  5. Without removing or shifting the plate, press the part into the wall the same way round as in Bambu Studio (front of the model to the front of the plate), then press Resume.
  6. The printer reheats, purges, travels above the part and prints the rest. The first 2 layers on the part are 10 °C hotter, half speed and without part cooling for adhesion.

The insert tab after pressing Preview

After Preview, the right side shows the plate from above: the part (beige), the bottom and the rim of the wall (grey and red), the first layer that will be printed on the part (blue) and the supports that will be reprinted (green). Result on the left says which layers become the wall, where printing continues after the pause and how thick the first layer on the part will be, followed by any warnings. The advanced settings open under the preview.

How the wall is made: the part's own outline is read from the sliced layers below the wall height. The opening at every height lets all sections below it pass (the part is lowered from above), with 0.25 mm clearance, a 4-line wall, a 5 mm brim and a small lead-in chamfer at the rim. All of these can be changed after ticking Show advanced settings (next to the preview).

Supports. If the model has supports that reach above the part height (for example tree supports inside a hollow part, or next to it), their lower part is printed again before the pause, wherever the part will not hit them when it is lowered in. Remove the old supports from the part before seating it. Supports that only held the part's own overhangs are left out. Turn this off with Reprint the supports below the part height in the advanced settings (CLI --no-reprint-supports). Test 4 shows this on a hollow rocket body.

Getting a good fit:

  • If the part sits loose in the wall, lower the clearance. On a round part, the default 0.25 mm was clearly too loose and 0.12 mm gave a much tighter fit.
  • Parts that widen upwards (like a boat hull) touch the wall only on sloped surfaces, so the nozzle can drag them up and out. Fix such a part with a few dots of hot glue over the seam, squeezed onto the wall rather than the part: it comes off the part cleanly afterwards. (Test 3)
  • Seat the part level all around. Even 0.2 mm higher on one side shows up as layer lines on the other.

Limits: one object on the plate, no prime tower, part at least 3 mm tall and 5 mm wide. The Z of everything printed on top is shifted by the difference between the measured height and the nearest model layer, so the first layer sits on the real part. If the top surface is a cut (infill exposed), add a height range modifier in Bambu Studio from the part height to about 0.6 mm above it with 100 % sparse infill density, so the first layers are solid.

What the generated job does

It keeps the original header and settings, drops the start sequence and the finished layers, restores temperatures, fans and motion limits, lifts the nozzle, homes X/Y only (G28 X), purges at the rear chute, moves above the first point of the layer, lowers onto it and continues with the original G-code to the end.

It never homes Z and never runs bed leveling. In manual mode every Z move is relative to the position you aligned, so the job does not depend on the Z the printer thinks it is at after a restart.

The file is rewritten in place and a .layer-rescue.bak copy of the original is kept next to it.

Limitations and what's next

Layer Rescue saves prints, but it can't make the repair invisible or do everything yet. Here's what to expect:

  • The seam usually shows. In most tests there was a visible layer line where the print restarted, even with the exact right layer. With the right layer, the seams I've handled didn't tear, crack or crush, but I haven't done proper strength tests yet, and the result depends on the model and the filament. For functional parts, a few drops of superglue on the seam don't hurt.
  • You pick the layer, and mistakes show. There's no automatic detection of where the print really stopped. See Picking the layer.
  • After a restart, the result depends on your hands. The nozzle is placed on the part by eye.
  • Insert mode is still beta. How well a part fits the wall depends a lot on its shape: some drop in and sit snugly, some can shift, some need glue, and some may not fit at all. Round parts can't be oriented by the wall, so you have to seat them facing the right way. It handles one object on the plate and no prime tower.
  • Printed on one printer so far. The real-world tests were printed on a Bambu Lab P1S with a single filament. The sequences for the other Bambu Lab printers were checked against their own sliced G-code and Bambu's templates (see Tested on), but not printed yet, so watch the start closely.
  • Power-cut mode on the H2 series, the P2S, the X2D and the A2L is experimental. After a power cut Z is not homed, and the purge, wipe and X homing commands the H2 needs (G150.3, G150.2, G150.1, G28 X T300) are firmware macros whose Z behaviour on an unhomed axis isn't documented. Like the stock start G-code, Layer Rescue lowers the bed 30 mm before these commands (also before the end G-code's), but this hasn't been checked on a printer yet: watch the first moves and be ready to stop. On the A2L, also turn timelapse off: its timelapse moves to the purge bin with G150.3 on every layer, 0.4 mm above the part.

Roadmap

Short term: make what's there reliable

  • Fixed test files from the real prints, so a new feature can't quietly break an old case.
  • A "copy report" button that puts the version, printer, settings and warnings into one text for bug reports.
  • Help with finding the last good layer, for example turning a caliper height into a layer number.
  • Dropping failed objects from a crowded plate without re-slicing.
  • A short guide in the window that asks what happened and picks the right mode.
  • Real prints on the printers that have only been checked against sliced files so far (X1 Carbon, A1, H2D and the rest of the table), plus an FAQ.

Mid term: insert mode for more shapes

  • Parts that widen towards the top, and other shapes that don't sit well in the wall today.
  • Clearance presets based on the part's shape.
  • Taking insert mode out of beta once it works on a wider range of parts.
  • Research: setting Z after a power loss automatically, by touching the nozzle to the part or by using the camera or other printer data instead of doing it by eye. Idea from u/robiebab.

Long term: supports that don't start from the bed

  • Research: holding up a tall overhang without printing the whole support underneath. A few small ledges on the model carry a metal bar or another rigid part placed mid-print, and the overhang is printed on top of it. Idea from u/Thing1_Tokyo.
  • OrcaSlicer support and printers from other brands.

Got an idea or a use case that doesn't fit here? Open an issue.

Share your results

Layer Rescue gets better with every real print it sees. If something didn't work, or the result looked odd, please open an issue with the G-code, your printer and firmware version, the settings you used and a few photos. And if it saved a print for you, especially on a printer or with a filament I haven't tried, I'd love to hear about that too: successful prints on new setups are exactly what's needed before they can be enabled.

Command line

layer-rescue --analyze print.gcode
layer-rescue --last-layer 461 --z-mode retained print.gcode
layer-rescue --last-layer 461 --z-mode manual --confirm-manual-z-aligned print.gcode

Insert mode:

layer-rescue --part-height 23.4 --wall-height 10 --confirm-attended print.gcode
layer-rescue --part-layer 117 --confirm-attended --preview-svg wall.svg print.gcode

Insert options: --clearance, --wall-lines, --brim, --no-chamfer, --z-fine, --standby-temp, --adhesion-layers, --no-reprint-supports.

--allow-untested accepts the risks of an untested printer or multi-filament job. --nozzle-temp and --bed-temp override the detected temperatures. Run layer-rescue --help for all options.

Credits

The idea of resuming a print from a chosen layer comes from CNC Kitchen's guide to resuming a failed 3D print. When I started this project, I mostly wanted to automate the manual steps from that guide for Bambu Studio, so thanks to CNC Kitchen for explaining it so clearly. Everything else (insert mode with its holding wall, support reprinting, the safety checks and output validation) was designed from scratch for Layer Rescue.

Thanks also to the designers of the models I used in the tests:

The roadmap also has ideas from the community: thanks to u/robiebab for automatic Z after a power loss, and to u/Thing1_Tokyo for placed-object supports.

Contributing

Bug reports with the printer model, firmware version and G-code are the most useful contribution. See CONTRIBUTING.md.

License

MIT. Not affiliated with or endorsed by Bambu Lab.

Metadata

Release files for layer-rescue 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for layer-rescue 1.1.0
File Size Uploaded
layer_rescue-1.1.0.tar.gz 144.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for layer-rescue 1.1.0
File Interpreter ABI Platform
layer_rescue-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 269.9 kB

Release files / layer_rescue-1.1.0.tar.gz

Download URL layer_rescue-1.1.0.tar.gz
Size 144.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9e07c0921c5214785cb6e2da71afd1a3b18c19d74a76f898e4cdda74b85b004a
BLAKE2b-256 checksum
How to use checksums
9bc56bfd0a6fef2cf3bce5dba617d73a1d0e6d5f8ecfbce355d69d614db3088e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release files / layer_rescue-1.1.0-py3-none-any.whl

Download URL layer_rescue-1.1.0-py3-none-any.whl
Size 125.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3a09b43956ba6968697b9f29360f61d4eb0bd3a7121e826574e1478ce48df7c
BLAKE2b-256 checksum
How to use checksums
726c4d79ca1446ea4e65bcd33a86ac00fd9418f1b249253ea22185eef359ecbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page