Skip to content

Slicing guide ​

Choose a path ​

There are two ways to get a printable file.

Path A: slice in your slicer's GUI, then hand the file to the server. Slice, check the preview, and export. Then upload a .gcode file with upload_gcode, or print a sliced Bambu .3mf with print_3mf. You see exactly what will print, so this is the most predictable path.

Model ──► slicer GUI ──► sliced .gcode / .gcode.3mf ──► upload_gcode or print_3mf
          slice + preview + export

Path B: let the server run your slicer's command line. slice_stl runs the configured slicer and returns the output path. Your agent can then check temperatures with confirm_temperatures and upload the result. This is what makes "edit this model and print it" work end to end, but it depends on your installed slicer and profiles.

STL / 3MF ──► slice_stl ──► slicer CLI ──► .gcode (or sliced .3mf for Bambu) ──► upload_gcode / print_3mf

Printing a file that is already sliced needs no slicer on the MCP host. Either way, every print start goes through the print safety gate.

Pause before a layer ​

For magnets or nuts, pass pause_at_layers: [3, 12] to slice_stl or slice_with_template on the Bambu-compatible CLI path. These are 1-based preview layer numbers, at least 2. The server first slices to find the exact layer heights, then uses --load-custom-gcodes to have the slicer insert the machine's own pause (Bambu's M400 U1). The printer pauses by itself and waits for Resume. Saved project pauses and custom G-code are carried into the CLI slice too.

print_3mf accepts the same option when it must auto-slice an unsliced project. An already sliced file must contain every requested pause or the request is refused before upload. A CLI result that omits a requested pause is also refused. Other slicers reject this option. Automated coverage uses fake CLIs; this port has not been verified with a physical printer or a real slicer.

Slicer types and aliases ​

Set SLICER_TYPE in the server environment, or pass slicer_type to a tool.

SLICER_TYPESlicerOutputAlso accepted
prusaslicerPrusaSlicerG-codeprusa
slic3rSlic3rG-code
orcaslicerOrcaSlicerG-code, or a sliced Bambu .3mf when the call passes bambu_modelorca, orca-slicer
curaCuraEngineG-codecuraengine
orcaslicer-bambulabFULU OrcaSlicer-bambulabSliced Bambu .3mffulu-orca, fulu_orca, orca-studio, orca_studio, orcastudio, orca-bambulab, orca_bambulab, orcaslicer_bambulab
bambustudioBambu StudioSliced Bambu .3mfbambu-studio, bambu_studio

The environment variable accepts every alias. A tool's slicer_type argument accepts the canonical names plus fulu_orca, fulu-orca, orca-studio, and orca_bambulab.

When SLICER_TYPE is not set, the server uses bambustudio if PRINTER_TYPE=bambu, and prusaslicer otherwise. FULU OrcaSlicer-bambulab is chosen with SLICER_TYPE=orcaslicer-bambulab: its v1.0.0 command line segfaults on every slice until FULU #56 and #57 are released.

Where the server looks for the slicer ​

SLICER_PATH always wins. Without it:

  • FULU OrcaSlicer-bambulab uses FULU_ORCA_PATH, ORCASLICER_BAMBULAB_PATH, or ORCA_SLICER_BAMBULAB_PATH, then the first existing path among /Applications/OrcaSlicer.app/Contents/MacOS/OrcaSlicer, /Applications/Orca Studio.app/Contents/MacOS/OrcaSlicer, /Applications/OrcaStudio.app/Contents/MacOS/OrcaStudio, /usr/local/bin/orcaslicer, and /usr/bin/orcaslicer, then orcaslicer on PATH.
  • Bambu Studio tries /Applications/BambuStudio.app/Contents/MacOS/BambuStudio, /Applications/Bambu Studio.app/Contents/MacOS/BambuStudio, /usr/local/bin/bambustudio, and /usr/bin/bambustudio, then bambustudio on PATH.
  • PrusaSlicer, Slic3r, OrcaSlicer, and CuraEngine need SLICER_PATH.

A per-call slicer_path is refused unless MCP_ALLOW_EXECUTABLE_ARG=1; see executable settings. Slicer runs time out after SLICER_TIMEOUT_MS (10 minutes by default).

Profiles ​

SLICER_PROFILE (or the slicer_profile argument) and FILAMENT_PROFILE (or filament_profile) mean different things for each slicer:

SlicerSLICER_PROFILEFilament profile
PrusaSlicer, Slic3rOne config file exported from the slicer (File > Export > Export Config), containing printer, print, and filament settingsOptional: one filament preset .ini (from the slicer's filament folder), loaded with a second --load after the config so its filament settings win
Generic OrcaSlicer (no bambu_model)Machine and process JSON files separated by ;, optionally followed by a filament file (see below)Loaded with --load-filaments
CuraEngineA Cura definition JSONNot used
Bambu Studio, FULU OrcaSlicer-bambulab, or OrcaSlicer with bambu_modelOne process profile only. The machine preset always comes from the printer model and nozzle; a machine;process list is rejected with instructions;-separated, in slot order, loaded with --load-filaments

For generic OrcaSlicer, a filament preset that inherits other installed presets (as bundled ones such as Generic PETG @System do) is passed to --load-filaments with its inheritance chain merged in, because the CLI does not resolve inherits. Your files are not modified.

A filament file can also ride along in the profile setting after a pipe character; a load_filaments or filament_profile given to the call replaces it:

env
SLICER_PROFILE=/path/to/machine.json;/path/to/process.json|/path/to/filament.json

Generic OrcaSlicer writes plate_1.gcode; the server renames it after the input model and returns that path. Do not use this form for Bambu Lab slicing: pass bambu_model (or use Bambu Studio or FULU OrcaSlicer-bambulab) and give only a process profile.

Layer height, walls and infill ​

slice_stl and slice_with_template take quality (draft, standard, fine) and strength (standard, strong, max), so a client can send the person's choice without slicer numbers. The server picks the layer height for the nozzle (0.28 and 0.12 mm on a 0.4 mm nozzle; it scales with nozzle_diameter, or NOZZLE_DIAMETER when that's not given, which for PrusaSlicer, Slic3r and generic OrcaSlicer must match the nozzle in slicer_profile) and the walls and infill (at least 4 walls and 25%, or 6 and 40%: a process that already has more, such as a designer's 3MF at 100% infill, keeps it). Standard keeps the process as it is; explicit values win. Cura takes only Standard.

slice_stl and slice_with_template accept layer_height (mm), wall_loops (a whole number of walls), and sparse_infill_density (a percentage such as "15%"; a bare number is read as a percentage). They are written over the profile the slice would otherwise use, so they win over the preset, SLICER_PROFILE, and a template:

SlicerHow they are applied
Bambu Studio, FULU OrcaSlicer-bambulab, OrcaSlicer with bambu_modelProcess keys layer_height, wall_loops, sparse_infill_density, written into the resolved process profile the CLI loads
Generic OrcaSlicerThe same keys, written into a copy of the process profile (the settings file whose type is process, else the last of two or more). A machine-only slicer_profile is refused
PrusaSlicer, Slic3r--layer-height, --perimeters, --fill-density, which override the loaded config
CuraEngineRefused; set them in the Cura definition

Your profile files are never modified. The slicer still validates the values against the machine, for example a layer height larger than the nozzle allows.

Bambu-compatible slicing ​

Bambu Studio, FULU OrcaSlicer-bambulab, and OrcaSlicer with bambu_model produce a sliced Bambu .3mf. Before the slicer runs, the server prepares the profiles itself:

  1. Machine preset. It takes the model from bambu_model (or BAMBU_MODEL, asked for through elicitation when missing) and the nozzle from nozzle_diameter (or NOZZLE_DIAMETER, default 0.4), and finds the exact <model> <diameter> nozzle machine preset, such as Bambu Lab P1S 0.4 nozzle, in the selected installation's BBL profile tree. The tree is found from SLICER_PATH, or set with BAMBU_PROFILES_ROOT for AppImages and non-standard installs. A preset is never borrowed from another installation.
  2. Resolution. inherits and include chains are flattened, and the model's cli_config.json entry is validated. Custom process and filament parents are looked up in BAMBU_SLICER_PROFILE_DIRS (default: the slicers' user system/BBL directories), never machine presets.
  3. Process and filaments. slicer_profile, a template, or BAMBU_TEMPLATE_3MF_PATH supplies process settings. Machine settings carried by process, filament, or template files are dropped, so they cannot replace the selected preset's start G-code.
  4. Checks. Missing presets, wrong nozzle sizes, missing parents or includes, cycles, malformed profiles, missing process or filament files, and machine/process lists in slicer_profile all stop before the slicer runs.
  5. Output. The result must contain a nonempty Metadata/plate_<n>.gcode. A checksum-only archive, missing output, or a stale file from an earlier run is an error. Slicer failures report the exit code or signal, whether it timed out, the tails of stdout and stderr, and slicing-specific suggestions. Bambu Studio and OrcaSlicer failures also name the CLI's own reason, from the result.json it writes on Linux or from its exit code.

Slicing accepts p1s, p1p, p2s, x1c, x1e, a1, a1mini, h2d, h2s, and h2c when the installed slicer has that preset. Printing accepts p1s, p1p, x1c, x1e, a1, a1mini, and h2d.

slice_stl and slice_with_template also take bed_type, nozzle_type, load_filaments, load_filament_ids, filament_colours, template selection, and the Bambu CLI placement and transform options (orient, arrange, ensure_on_bed, repetitions, clone_objects, skip_objects, slice_plate, scale, rotate, rotate_x, rotate_y, uptodate, min_save, skip_modified_gcodes, enable_timelapse, allow_mix_temp). See the slicing tools reference.

OrcaSlicer CLI limits. OrcaSlicer 2.4.2's CLI segfaults in PartPlate::check_outside, which needs the GUI, when scale, rotate_x or rotate_y moves an object below the bed while it arranges, the default for STL input. OrcaSlicer fixed this after 2.4.2 in #14415, first released in 2.5.0-alpha. Orca rotates about the object's origin, so even a rotation that shrinks a part's height can crash it. For STL input with orcaslicer or orcaslicer-bambulab, the server applies scale, rotate_x, rotate_y and, with any of them, rotate to a copy of the mesh, and omits those flags. It follows Orca's own composition, whatever the argument order: scale, then X, then Y, then Z. A 10 × 20 × 30 mm box turned 90° about Z and X is therefore 20 mm tall. Orca then places the copy on the plate, and the copy is deleted after slicing. A rotate alone stays a CLI flag. For a 3MF, arrange: true with scale above 1, rotate_x or rotate_y is refused before slicing; set arrange to false or transform the object in the slicer. repetitions on an STL becomes --clone-objects for both OrcaSlicer and Bambu Studio and cannot be combined with clone_objects. clone_objects takes one total copy count: the CLI counts copies per input file, and this tool loads one file. Bambu Studio retains its transform flags; selected 3MF plates retain --repetitions. The crash and its fix were found in bambu-printer-mcp 1.1.34 with a 140-run OrcaSlicer 2.4.2 option matrix on Linux; this server's regressions use a fake CLI that records the mesh it receives.

Evidence. Bambu Studio 02.01.01.52 sliced a P1S 0.4 nozzle job through this path, including a 9.7 MB refitted phone-case STL in Bambu TPU 95A HF (230 °C nozzle, 35 °C plate, about 1 h 38 min and 21 g); see the Blender guide's worked example. Before this change, Bambu Studio rejected the raw inherited P1S preset with exit 239 ("process not compatible with printer"). Other slicer versions and models have not been tested here.

Slicing templates ​

A template is a saved .3mf, .json, or .config file whose slicer settings are reused as the process profile. Templates live in a local registry, BAMBU_TEMPLATE_DIR (default ~/Sync/bambu/templates); every tool also accepts a template_dir override.

  • save_template copies a file into the registry under a name (default: the source filename).
  • list_templates lists the saved templates.
  • get_slice_settings shows a template's or file's layer height, infill, walls, supports, brim, bed, printer, and filaments without slicing.
  • slice_with_template slices with a named template. The machine preset still comes from bambu_model and nozzle_diameter, and an explicit slicer_profile in the call overrides the template.

slice_stl accepts template_3mf_path or template_name too, and uses BAMBU_TEMPLATE_3MF_PATH as a default template when set. A 3MF that carries its own process settings (a designer's Bambu Studio or Orca project) slices with them instead of the default template or profile, unless the call names one; the machine still comes from bambu_model.

Printing what you sliced ​

  • G-code (any backend): upload_gcode with gcode_path and print: true inspects the exact file, checks the printer, and starts it. Without print, the file is only uploaded. Printing needs a declared material: ; filament_type in the G-code or the material argument.
  • Sliced Bambu .3mf: print_3mf inspects the selected plate, compares it with a fresh printer report, then uploads the project over FTPS and starts it over MQTT. It works only with PRINTER_TYPE=bambu, and bed_type must match the plate's bed metadata. The job's nozzle type must also match the printer's reported nozzle: Bambu machine presets assume the stock nozzle (stainless steel on P1S, P1P, and A1; hardened steel on X1C and X1E), so if you upgraded yours, slice with nozzle_type (or set BAMBU_NOZZLE_TYPE). After the print command, the server watches the printer's reports and says whether it started, stayed silent, or was refused by the firmware.
  • Check first: confirm_temperatures reports every heater target in a G-code file (S and R forms, tool-addressed, RepRapFirmware G10/M568, and Klipper SET_HEATER_TEMPERATURE). An expected temperature matches only when it equals the file's highest target, returned as peak. It does not change the file.

If a .3mf passed to print_3mf has no plate G-code, the server tries to slice it first with the configured Bambu-compatible slicer and your printer model's machine preset. If slicing fails, or the selected plate still has no G-code, print_3mf stops with an error and never uploads the original project. Export a sliced plate from the GUI (Path A) for the most predictable result.

Layer height, temperatures, and other slicer settings are baked into the sliced file. Change them in the slicer and slice again; print_3mf accepts layer_height, nozzle_temperature, bed_temperature, and support_enabled but does not apply them.

process_and_print_stl ​

This one-call pipeline extends the model's base (extension_inches, converted at 25.4 mm per inch), slices it, and prints it through the same checked gate as upload_gcode and print_3mf. If you pass extruder_temp or bed_temp, each must equal the sliced job's highest target (S and R forms, every tool); otherwise nothing is uploaded. Pass material when the sliced G-code has no filament_type metadata. For a Bambu printer with a Bambu-compatible slicer, the sliced .3mf goes through the print_3mf checks.

Use the separate slice_stl, confirm_temperatures, and upload_gcode steps when you want to inspect the sliced file before it prints.

Slicing in Docker ​

The Docker image does not include a slicer, and a slicer installed on the host generally cannot run inside the container because of library and OS differences. To slice in a container, build a derived image that installs a Linux build of your slicer, set SLICER_PATH to its path inside the container, and set BAMBU_PROFILES_ROOT if its profile tree is not found automatically. See Running with Docker.

Troubleshooting ​

  • The slicer opens its GUI or hangs: some slicers fall back to the GUI when the command line is incomplete. Configure a complete SLICER_PROFILE and check that SLICER_PATH points at the executable, not the app bundle folder.
  • PrusaSlicer ignores my settings: SLICER_PROFILE must be a single exported config file, not a folder of profiles.
  • Bambu slicing cannot find the machine preset: point SLICER_PATH at the executable inside a full Bambu Studio, OrcaSlicer, or FULU OrcaSlicer-bambulab install that includes your model and nozzle, or set BAMBU_PROFILES_ROOT to its profile tree. SLICER_PROFILE cannot supply a machine preset.
  • slicer_profile is rejected for listing a machine preset: on the Bambu-compatible path, pass only the process profile. The machine preset comes from bambu_model and nozzle_diameter.
  • A custom process or filament profile's parent is missing: add the directory holding it to BAMBU_SLICER_PROFILE_DIRS.
  • The slice fails with an exit code: read the reported reason, output tails and suggestions. The reason after the command comes from the CLI's result.json or its exit code; for example Bambu Studio's exit 239 (-17) means the process profile does not fit the printer preset, and exit 206 (-50) means no object sits fully on a plate.
  • A 3MF slice with scale, rotate_x or rotate_y is refused for OrcaSlicer: with arrange: true that combination crashes Orca's CLI. Set arrange to false, or apply the transform in the slicer and export the project; see OrcaSlicer CLI limits.
  • FULU OrcaSlicer-bambulab CLI crashes: FULU v1.0.0's CLI crashes on every run in PartPlate::invalidate_plate_name_texture (fixes proposed in FULU #56 and FULU #57); see upstream bugs and current FULU status. Export from FULU's GUI, or use upstream OrcaSlicer's or Bambu Studio's CLI.
  • Long slices time out: raise SLICER_TIMEOUT_MS.
  • A slice on a Mac stops with slicer-waiting-on-dialog: the slicer used no CPU and wrote nothing for SLICER_STALL_SECONDS (20 by default), as it does while a window waits for an answer. Each Bambu Studio, OrcaSlicer or FULU slice already runs with an empty CFFIXED_USER_HOME of its own under TEMP_DIR, so macOS's "reopen windows?" question after a crash can't stop it. Open the slicer once, answer what it shows, quit it, and slice again.

Released under the GPL-2.0 license. An independent open-source project, not affiliated with any printer manufacturer or host software.