compose_multicolor_3mf
Combines multiple STL files into one multi-color, multi-material .3mf with per-part AMS extruder slot assignments, ready for slicing in BambuStudio, OrcaSlicer, PrusaSlicer, or Cura.
Instructions
Compose a multi-color / multi-material .3mf from multiple STL files.
Creates a **single .3mf, ready to slice**, containing all parts with
per-part AMS/extruder slot assignments. This is the correct way to hand
a multi-color design to a slicer — it receives one file, not multiple.
It is a model, not a sliced plate, so no printer starts it as it stands:
slice it first. ``fits_bed`` says whether the plate fits the bed it was
composed for; when it does not, the message says by how much and what to
do, and does not offer it for printing.
Parts whose bodies touch or overlap are one print: they become ONE
object with a part per input, and where two overlap the smaller part is
printed. Parts placed apart stay separate objects.
Compatible with:
* **BambuStudio / OrcaSlicer / Bambu A1, X1, P1 + AMS** — read ``Metadata/model_settings.config``
* **PrusaSlicer / MMU** — reads ``Metadata/Slic3r_PE_model.config``
* **Cura** and any 3MF-capable slicer
Typical two-color workflow::
# 1. Export body STL (main color, e.g. grey PLA)
# 2. Export accent STL (second color, same coordinate origin)
# 3. Compose:
result = compose_multicolor_3mf(parts=[
{"stl_path": "/tmp/body.stl", "extruder": 1,
"name": "body", "color": "#AAAAAA", "material": "PLA Grey"},
{"stl_path": "/tmp/qr_pads.stl", "extruder": 2,
"name": "qr_code", "color": "#111111", "material": "PLA Black"},
])
# 4. Slice and print (or slice_model to look at the slice first):
slice_and_print(result["output_path"])
Args:
parts: List of part dicts. Each dict requires:
* ``stl_path`` (str) — absolute path to the STL for this part
* ``extruder`` (int) — 1-indexed AMS slot (1 = AMS tray 1 on
Bambu); omitted, 1
Optional per-part keys:
* ``name`` (str) — label shown in the slicer object list
* ``color`` (str) — hex preview color e.g. ``"#AAAAAA"`` (display only)
* ``material`` (str) — filament label e.g. ``"PLA Grey"`` (display only)
output_path: Where to write the .3mf. Defaults to a temp file whose
path is returned in the result.
plate_width: Print plate X dimension in mm (default 256 for legacy
callers without a printer id).
plate_depth: Print plate Y dimension in mm (default 256).
material: Optional material the parts will be printed in (e.g.
``"PETG"``). A spool on record in a clearly different
material is then not named as one to load.
printer_id: Optional supported printer model id. When it resolves,
its build volume overrides ``plate_width`` / ``plate_depth``.
The composer centres an off-plate group on THIS plate, so name
the printer whenever you know it — a group arranged for a
larger or smaller bed and composed against the 256 default is
re-centred onto a plate the machine does not have.
Returns:
Dict with ``success``, ``output_path``, ``parts``, ``objects`` (build
objects, after touching parts are joined), ``colours`` (extruder
slots used), ``total_triangles``, ``total_vertices``, ``extruder_map``
(which parts print from each slot), ``fits_bed`` (``False`` when the
plate is bigger than its bed, ``None`` when it could not be measured),
``bed_fit`` (the sizes behind that verdict), and ``message``. It also says
whether the part colours 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.INLINE 3D STAGE: on success this tool opens Kiln's interactive 3D stage — an inline viewer panel the user can orbit, zoom, and turn over — in hosts that render MCP Apps panels (Kiln's hosted connection attaches a browser stage link for hosts that don't). Oversized meshes are decimated automatically for the stage; the PNG preview is the floor, not the whole experience.
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": {
"parts": "<parts>"
},
"name": "compose_multicolor_3mf"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parts | Yes | List of part dicts. Each dict requires: * ``stl_path`` (str) — absolute path to the STL for this part * ``extruder`` (int) — 1-indexed AMS slot (1 = AMS tray 1 on Bambu); omitted, 1 Optional per-part keys: * ``name`` (str) — label shown in the slicer object list * ``color`` (str) — hex preview color e.g. ``"#AAAAAA"`` (display only) * ``material`` (str) — filament label e.g. ``"PLA Grey"`` (display only) | |
| material | No | Optional material the parts will be printed in (e.g. ``"PETG"``). A spool on record in a clearly different material is then not named as one to load. Default: "". | |
| printer_id | No | Optional supported printer model id. When it resolves, its build volume overrides ``plate_width`` / ``plate_depth``. The composer centres an off-plate group on THIS plate, so name the printer whenever you know it — a group arranged for a larger or smaller bed and composed against the 256 default is re-centred onto a plate the machine does not have. Default: "". | |
| output_path | No | Where to write the .3mf. Defaults to a temp file whose path is returned in the result. Default: "". | |
| plate_depth | No | Print plate Y dimension in mm (default 256). Default: 256.0. | |
| plate_width | No | Print plate X dimension in mm (default 256 for legacy callers without a printer id). Default: 256.0. |