Export a part to a file
export_partExport a part and return the absolute path written. format is 3mf for printing — what Bambu Studio, OrcaSlicer, PrusaSlicer and Cura open, with every body its own named object in millimetres — stl for a bare mesh any tool reads, or step for exact surfaces, for another CAD program or a machine shop. Files are written to the parcad export directory; the filename must have no directory part. On a hosted parcad the reply also carries url, a signed link that fetches the file with no token until it expires, and path is then relative to the account's folder. The reply's measured describes the part in the file, off the same build that wrote it: size, volume, watertight, bodies, voids, and for 3MF and STL the deflection_mm every triangle is within. Reuses the build of an earlier evaluate_part on the same script; timeout_s gives a heavy part longer.
A part that returns several bodies (return { base, lid }) is written whole by default — one object per body in 3MF, one solid per body in STEP, every body's triangles merged into one STL, where a slicer can no longer tell them apart — and measured.named_bodies then measures each body in the file. Pass body: "lid" to write that one body alone. A .reference() body is never in the file and cannot be asked for by name.
STL and 3MF describe closed solids and refuse a part with a surface body, naming .thicken(t); STEP carries surfaces exactly.
A part whose print_check fails — material under 0.3 mm, where nothing prints — or that carries its own checks and fails one is refused, with the finding or the check and its measurement named, and nothing is written. allow_failing carries the user's words accepting that it fails, for writing it anyway; the reply keeps it and the file carries it: in an STL's header, a STEP comment, or a 3MF's Description. The reply opens with print_check and checks, the verdicts the file was written under; a flagged print_check writes the file and lists what to read.
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": {
"format": "<format>"
},
"name": "export_part"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | No | For a part that returns several bodies (`return { base, lid }`): the name of the one body to write on its own, e.g. `lid`. Omit to write every body into one file — an object per body in 3MF, a solid per body in STEP, all of their triangles in one STL. Refused by name when the part has no such body. | |
| edits | No | Changes to make before building, in order, each { old, new } replacing text that appears exactly once; nothing is written back to the part. | |
| format | Yes | `3mf` for a slicer, `stl` for a bare mesh, or `step` for exact surfaces. | |
| script | No | A parcad DSL script ending in a returned shape. Give this or `project`, not both. | |
| project | No | The part to export instead of sending it, as list_projects spells it, or "@session" for the script on the user's screen. | |
| filename | No | File name to write, without any directory part. Defaults to `part.3mf` / `part.stl` / `part.step`. | |
| timeout_s | No | Seconds the kernel may take, 1 to 600. Defaults to 20, or PARCAD_OCCT_TIMEOUT. Reuses the build of an earlier evaluate_part on the same script when there is one. | |
| allow_failing | No | The user's words accepting that the part fails a check or the print check, such as "export it, I'll ream the bore out". Fixed dimensions in a brief, or the request for the file, accept no failure. Without it a failing verdict refuses the export, naming it and what was measured; with it the reason is kept in the reply. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | ||
| path | Yes | ||
| brief | No | ||
| bytes | Yes | ||
| checks | No | ||
| format | Yes | ||
| opened | No | ||
| measured | Yes | ||
| downloaded | No | ||
| open_error | No | ||
| print_check | No | ||
| allow_failing | No | ||
| script_sha256 | Yes | ||
| matched_loosely | No |