Preview G-code
preview_gcodeRender a G-code file as a PNG to visually inspect toolpaths before printing, with top and side views plus layer-colored wall, infill, and support details.
Instructions
Draw G-code toolpaths as a PNG so you and the user can check a slice before printing.
view='top' without a layer shows placement on the bed; with a layer it colours walls orange/yellow, infill red, top surfaces pink, bottom blue, bridges cyan and support teal. view='side' shows overhangs and support. For a build-up animation use animate_layers; for a shareable summary use print_card. Read-only: returns the image and layer metadata without writing files.
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": {
"path": "<path>"
},
"name": "preview_gcode"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to a .gcode file on this computer, e.g. one written by slice_model. | |
| size | No | Image size in pixels, 200 to 2000. | |
| view | No | 'top' (from above) or 'side' (front elevation of the whole print). | top |
| layer | No | 1-based layer to draw coloured by feature. Omit to draw every layer shaded by height. |