compose_multicolor_3mf
Combine multiple STL files into a single multi-color 3MF file with per-part extruder assignments for AMS/MMU printers. Outputs a print-ready file for Bambu, Prusa, and other FDM slicers.
Instructions
Compose a multi-color / multi-material .3mf from multiple STL files.
Creates a **single print-ready .3mf** containing all parts with per-part
AMS/extruder slot assignments. This is the correct way to send a
multi-color design to any FDM printer — the printer receives one file,
not multiple.
Compatible with:
* **BambuStudio / Bambu A1, X1, P1 + AMS** — reads ``Metadata/model_settings.config``
* **PrusaSlicer / MMU** — reads ``slic3rpe:extruder`` on each ``<item>``
* **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. Upload and print:
upload_file(result["output_path"])
start_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)
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.
Returns:
Dict with ``success``, ``output_path``, ``parts``, ``total_triangles``,
``total_vertices``, ``extruder_map``, and ``message``.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parts | Yes | ||
| output_path | No |