Skip to content

Slicing Tools ​

See the slicing guide for slicer types, profiles, and troubleshooting. Slicing a file yourself in the slicer's GUI and uploading the result is the most predictable path.

slice_stl ​

Slice an STL or 3MF with the configured slicer and return the output path: G-code for PrusaSlicer, Slic3r, generic OrcaSlicer, and CuraEngine, or a sliced .3mf for the Bambu-compatible path.

The Bambu-compatible path is used for Bambu Studio, FULU OrcaSlicer-bambulab, and OrcaSlicer when the call passes bambu_model:

  • The machine preset always comes from bambu_model (or BAMBU_MODEL, asked for when missing) and nozzle_diameter (default NOZZLE_DIAMETER or 0.4). The exact <model> <diameter> nozzle preset must exist in the selected slicer installation. Its inherits and include chains are resolved before the slicer runs.
  • slicer_profile (or SLICER_PROFILE) is a process profile only. A machine;process list is rejected with instructions.
  • Slicing accepts p1s, p1p, p2s, x1c, x1e, a1, a1mini, h2d, h2s, and h2c when the installed slicer has that preset. Printing still accepts only the seven models in BAMBU_MODEL.
  • The output must contain a nonempty Metadata/plate_<n>.gcode. Failures stop with the slicer's exit code or signal, the tails of its output, and slicing-specific advice.
json
{
  "stl_path": "/path/to/phone-case.stl",
  "slicer_type": "bambustudio",
  "bambu_model": "p1s",
  "nozzle_diameter": "0.4",
  "bed_type": "textured_plate",
  "load_filaments": "/path/to/filaments/tpu-95a-hf.json",
  "arrange": true,
  "orient": false
}

Options for the Bambu-compatible path:

ArgumentWhat it does
bed_typeBuild plate: textured_plate, cool_plate, engineering_plate, or hot_plate (default BED_TYPE or textured_plate)
nozzle_typeInstalled nozzle: stainless_steel, hardened_steel, tungsten_carbide, or brass (default BAMBU_NOZZLE_TYPE, else the preset's stock nozzle). Printing requires it to match the printer's reported nozzle
load_filamentsFilament profile JSON paths in slot order, ;-separated. One profile applies to every slot; otherwise give one per slot. filament_profile is an alias
load_filament_idsComma-separated filament IDs mapping filaments to objects, such as 1,2,3,1
filament_coloursOne #RRGGBB per filament slot, ;-separated. Defaults to the input 3MF's colours, then each profile's colour
template_3mf_path, template_name, template_dirReuse a 3MF's or profile's slicer settings as the process profile (defaults: BAMBU_TEMPLATE_3MF_PATH, BAMBU_TEMPLATE_DIR). An explicit slicer_profile takes precedence
uptodate, min_save, skip_modified_gcodesRefresh 3MF presets to the installed slicer, write a smaller 3MF, or ignore custom G-code embedded in an input 3MF
orient, arrange, ensure_on_bed, repetitions, clone_objects, skip_objects, slice_platePlacement: auto-orient, auto-arrange (set false to keep a layout), drop floating models onto the bed, copies, per-object clone counts, objects to skip, and which plate to slice (0 = all)
scale, rotate, rotate_x, rotate_yTransform before slicing (uniform scale; rotations in degrees)
enable_timelapse, allow_mix_tempInsert timelapse parking moves; allow filaments with different temperature needs on one plate

Generic slicers keep their own profile formats: PrusaSlicer and Slic3r load one exported config, and generic OrcaSlicer takes machine.json;process.json, optionally followed by |filament.json. slicer_type, slicer_profile, and filament_profile fall back to SLICER_TYPE, SLICER_PROFILE, and FILAMENT_PROFILE. The slicer executable comes from SLICER_PATH; a per-call slicer_path requires MCP_ALLOW_EXECUTABLE_ARG=1. See the slicing guide.

slice_with_template ​

Slice an STL or 3MF with a named template from the local template registry. The template supplies the process settings; the machine preset still comes from bambu_model and nozzle_diameter. It takes the same arguments as slice_stl, and an explicit slicer_profile in the call overrides the template.

json
{
  "stl_path": "/path/to/bracket.stl",
  "template_name": "p1s-petg-strong",
  "bambu_model": "p1s"
}

list_templates ​

List the saved slicing templates (.3mf, .json, .config) in the registry directory, BAMBU_TEMPLATE_DIR (default ~/Sync/bambu/templates), or in template_dir.

json
{}

save_template ​

Copy a local .3mf, .json, or .config file into the template registry. template_name defaults to the source filename without its extension.

json
{
  "source_path": "/path/to/p1s-petg-strong.3mf",
  "template_name": "p1s-petg-strong"
}

get_slice_settings ​

Read the slicer settings in a 3MF, an extracted project_settings.config, or a profile JSON without slicing: layer height, infill, walls, supports, brim, bed, printer, and filaments. Pass source_path, or template_name to read a saved template.

json
{
  "template_name": "p1s-petg-strong"
}

confirm_temperatures ​

Report every heater target in a G-code file: S and R forms, tool-addressed targets, RepRapFirmware G10/M568, and Klipper SET_HEATER_TEMPERATURE. An expected extruder_temp or bed_temp matches only when it equals the file's highest target, which the result returns as peak. It is read-only; the printing tools enforce their own safety gate.

json
{
  "gcode_path": "/path/to/model.gcode",
  "extruder_temp": 240,
  "bed_temp": 80
}

process_and_print_stl ​

Extend an STL's base, slice it, and print it through the same checked print gate as upload_gcode and print_3mf, including the human confirmation. If you pass extruder_temp or bed_temp, each must equal the sliced job's highest target (S and R forms, every tool); a mismatch stops before anything is uploaded. Pass material when the sliced G-code has no filament_type metadata. On a Bambu printer with a Bambu-compatible slicer, the sliced .3mf goes through the print_3mf checks, and the printer model is required.

json
{
  "stl_path": "/path/to/model.stl",
  "extension_inches": 0.1,
  "extruder_temp": 210,
  "bed_temp": 60,
  "material": "PLA",
  "type": "octoprint",
  "host": "192.168.1.100"
}

Use slice_stl, confirm_temperatures, and upload_gcode separately when you want to review the sliced file before the print is offered for confirmation.

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