extract_plate_object
Extracts a single object's G-code from a multi-object Bambu .gcode.3mf file to produce a standalone, directly printable .gcode, preserving start/end sequences and removing other objects' toolpaths.
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.
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": {
"file_path": "<file_path>",
"object_name": "<object_name>"
},
"name": "extract_plate_object"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Path to the .gcode.3mf file. | |
| output_dir | No | Directory for the output .gcode file. Defaults to the same directory as the input file. Default: "". | |
| object_name | Yes | Name (or partial name) of the object to extract. | |
| plate_number | No | Which plate to extract from (1-based, default 1). Default: 1. |