extract_plate_object
Extract G-code for a specific object from a multi-object Bambu .gcode.3mf file, preserving machine startup and end sequences. Select plate and object by name.
Instructions
Extract a single object's G-code from a multi-object Bambu .gcode.3mf.
When a .gcode.3mf contains multiple objects (e.g. a lid and a body),
this tool extracts ONLY the G-code for the requested object, producing
a standalone .gcode file that can be printed directly.
The machine start-up (homing, levelling, heating) and end (cool-down,
park) sequences are preserved. Only the per-layer toolpath sections
for other objects are removed.
Bambu Studio supports multiple plates (plate_1, plate_2, etc.).
Use ``plate_number`` to select which plate to extract from.
Object matching is case-insensitive and supports partial names:
``"cap"`` will match ``"TreatHolder - cap.stl"``.
Use ``list_plate_objects`` first to see available object names.
:param file_path: Path to the .gcode.3mf file.
:param object_name: Name (or partial name) of the object to extract.
:param output_dir: Directory for the output .gcode file. Defaults to
the same directory as the input file.
:param plate_number: Which plate to extract from (1-based, default 1).
:returns: Dict with output path, matched object info, and line counts.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| output_dir | No | ||
| object_name | Yes | ||
| plate_number | No |