auto_arrange_parts_on_plate
Calculates non-overlapping XY positions for multiple parts on a print plate, placing grouped multicolor parts at the same XY, so separate objects can be arranged for one print job.
Instructions
Calculate non-overlapping XY positions for multiple parts on a print plate.
Use this **before** :func:`compose_multicolor_3mf` when you have multiple
separate objects (e.g., two coasters) to print in one job. Parts that
share the same ``group`` index are treated as a multi-color unit and
placed at the *same* XY position (they overlap intentionally).
Returns a list of positioned part specs ready to pass directly to
``compose_multicolor_3mf`` — pass the SAME ``printer_id`` to that
call: the composer re-centres a group it judges off ITS plate
(256mm by default), so composing a layout packed for a different
bed without the printer undoes this placement.
Arrangement strategy (free tier): simple left-to-right row layout. For
maximum plate density (2D bin-packing), use kiln-pro.
Example -- two coasters, each with a body + QR layer::
positioned = auto_arrange_parts_on_plate(part_specs=[
{"stl_path": "/tmp/c1_body.stl", "extruder": 1, "group": 0, "material": "PLA Grey"},
{"stl_path": "/tmp/c1_qr.stl", "extruder": 2, "group": 0, "material": "PLA Black"},
{"stl_path": "/tmp/c2_body.stl", "extruder": 1, "group": 1, "material": "PLA Grey"},
{"stl_path": "/tmp/c2_qr.stl", "extruder": 2, "group": 1, "material": "PLA Black"},
], plate_width=256, plate_depth=256, gap_mm=5)
# -> each part now has "x", "y" set; pass to compose_multicolor_3mf
Args:
part_specs: List of dicts, each with:
* ``stl_path`` (str) -- absolute path to the STL
* ``extruder`` (int) -- 1-indexed AMS slot
* ``group`` (int, optional) -- parts sharing a group get the same
XY position (multi-color unit). Default: each part is its own group.
* ``name`` (str, optional) -- label in slicer
* ``color`` (str, optional) -- hex preview color
* ``material`` (str, optional) -- filament label (also triggers
compatibility checks when passed to compose_multicolor_3mf)
plate_width: Print plate X dimension in mm (default 256);
replaced by the printer's own plate when ``printer_id``
is given.
plate_depth: Print plate Y dimension in mm (default 256);
replaced by the printer's own plate when ``printer_id``
is given.
gap_mm: Minimum spacing between groups in mm.
printer_id: Optional printer: a supported model id, or the
name of a printer set up in Kiln. When provided, its
recorded plate size replaces the explicit dimensions.
Returns:
Dict with ``success``, ``parts`` list (each part has ``x``, ``y`` set),
``group_count``, ``fits_bed`` (``False`` when the rows run past
the bed: the message then gives the layout's size, the bed's, and
what to do, instead of the next step), ``bed_fit``, and
``message``.
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": {
"part_specs": "<part_specs>"
},
"name": "auto_arrange_parts_on_plate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gap_mm | No | Minimum spacing between groups in mm. Default: 5.0. | |
| part_specs | Yes | List of dicts, each with: * ``stl_path`` (str) -- absolute path to the STL * ``extruder`` (int) -- 1-indexed AMS slot * ``group`` (int, optional) -- parts sharing a group get the same XY position (multi-color unit). Default: each part is its own group. * ``name`` (str, optional) -- label in slicer * ``color`` (str, optional) -- hex preview color * ``material`` (str, optional) -- filament label (also triggers compatibility checks when passed to compose_multicolor_3mf) | |
| printer_id | No | Optional printer: a supported model id, or the name of a printer set up in Kiln. When provided, its recorded plate size replaces the explicit dimensions. Default: "". | |
| plate_depth | No | Print plate Y dimension in mm (default 256); replaced by the printer's own plate when ``printer_id`` is given. Default: 256.0. | |
| plate_width | No | Print plate X dimension in mm (default 256); replaced by the printer's own plate when ``printer_id`` is given. Default: 256.0. |