wrap_gcode_as_3mf
Packages PrusaSlicer G-code into a Bambu-compatible 3MF with required BambuStudio start/end sequences so Bambu Lab printers accept and print it.
Instructions
Wrap raw PrusaSlicer G-code in a Bambu-compatible 3MF (Bambu Lab only).
Bambu printers require the proprietary BambuStudio start/end sequences
(motor enable, AMS load, extrusion calibration) to function correctly.
This tool takes PrusaSlicer G-code output and packages it into a 3MF
that the printer will accept.
Args:
gcode_path: Absolute path to a PrusaSlicer ``.gcode`` file on the
local filesystem. The file must have been sliced with
``--use-relative-e-distances`` and empty start/end G-code.
hotend_temp: Hotend temperature in °C for the start sequence.
Omitted, the temperature the G-code itself first heats to.
bed_temp: Bed temperature in °C, likewise.
filament_type: Filament type string — ``"PLA"``, ``"PETG"``,
``"ABS"``, etc. Omitted, the type the slicer wrote into the
G-code (every Kiln slice carries the material it was weighed
as). The response's ``filament_type`` is what the printer is
told, in Bambu's own vocabulary.
source_3mf_path: Optional path to a source 3MF to copy
thumbnails and geometry from.
num_filaments: Number of filaments (>1 for multi-color prints).
filament_colors: List of hex color strings per filament
(e.g. ``["#898989FF", "#161616FF"]``).
filament_types: List of filament type strings per filament
(e.g. ``["PLA", "PLA"]``).
thumbnail_path: Optional path to a PNG image to embed as the
3MF thumbnail (shown on the printer's display).
stl_path: Optional path to the source STL file. When provided,
a thumbnail is auto-generated from the model geometry via
OpenSCAD (512x512, shown on the Bambu printer screen).
bed_type: The plate fitted: ``"textured_plate"``, ``"hot_plate"``
(smooth PEI), ``"cool_plate"``, ``"eng_plate"`` or
``"supertack_plate"``. Omitted or empty, the textured plate;
any other name is refused. The
printer's start sequence trims the nozzle height for the plate
it is told, so say it when the plate is not the textured one.
resume_mode: ``True`` for a mid-print resume file that carries its own
preamble: the printer's full start sequence (homing, bed probe,
AMS load, purge, calibration) is left out, since re-running it
over a partial print risks a collision on Z. Default ``False``.
Returns a dict with ``output_path`` pointing to the generated 3MF.
Use ``upload_file()`` to send it to the printer, then ``start_print()``
to begin printing.
When ``filament_colors`` are given, the result says whether they are on
the printer, as ``colour_availability`` (absent when Kiln cannot see
what is loaded). Relay its ``say`` as written and add nothing about
filament: never suggest buying filament unless the person asks for one
or says yes to the offer in ``say``. On a yes, call
``find_closest_filaments`` with these colours and the print's material.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"gcode_path": "<gcode_path>"
},
"name": "wrap_gcode_as_3mf"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bed_temp | No | Bed temperature in °C, likewise. | |
| bed_type | No | The plate fitted: ``"textured_plate"``, ``"hot_plate"`` (smooth PEI), ``"cool_plate"``, ``"eng_plate"`` or ``"supertack_plate"``. Omitted or empty, the textured plate; any other name is refused. The printer's start sequence trims the nozzle height for the plate it is told, so say it when the plate is not the textured one. | |
| stl_path | No | Optional path to the source STL file. When provided, a thumbnail is auto-generated from the model geometry via OpenSCAD (512x512, shown on the Bambu printer screen). | |
| gcode_path | Yes | Absolute path to a PrusaSlicer ``.gcode`` file on the local filesystem. The file must have been sliced with ``--use-relative-e-distances`` and empty start/end G-code. | |
| hotend_temp | No | Hotend temperature in °C for the start sequence. Omitted, the temperature the G-code itself first heats to. | |
| resume_mode | No | ``True`` for a mid-print resume file that carries its own preamble: the printer's full start sequence (homing, bed probe, AMS load, purge, calibration) is left out, since re-running it over a partial print risks a collision on Z. Default ``False``. Default: false. | |
| filament_type | No | Filament type string — ``"PLA"``, ``"PETG"``, ``"ABS"``, etc. Omitted, the type the slicer wrote into the G-code (every Kiln slice carries the material it was weighed as). The response's ``filament_type`` is what the printer is told, in Bambu's own vocabulary. | |
| num_filaments | No | Number of filaments (>1 for multi-color prints). Default: 1. | |
| filament_types | No | List of filament type strings per filament (e.g. ``["PLA", "PLA"]``). | |
| thumbnail_path | No | Optional path to a PNG image to embed as the 3MF thumbnail (shown on the printer's display). | |
| filament_colors | No | List of hex color strings per filament (e.g. ``["#898989FF", "#161616FF"]``). | |
| source_3mf_path | No | Optional path to a source 3MF to copy thumbnails and geometry from. |