export_mesh
Exports a design, component, occurrence, or body as STL, 3MF, or OBJ with selectable tessellation refinement and optional overwrite of an existing file.
Instructions
Export the design, a component, an occurrence or a body as a mesh: STL, 3MF or OBJ (OBJ also writes .mtl). refinement low|medium|high, or custom with at least one of surface_deviation / normal_deviation / max_edge_length / aspect_ratio (numbers only; giving them without refinement="custom" is an error).
The path must be absolute, its directory must exist and its extension must match the format; an existing file is replaced only with overwrite=true (the old file is deleted first). Exporting does not save the document.
Returns {"files": [{"path", "size_bytes"}], "format", "scope"} (+ "warnings", e.g. file_units ignored for 3MF).
Example: export_mesh(path="C:/out/bracket.stl", scope="", refinement="high").
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute file path; the extension must match the format | |
| scope | No | Ref of a body, an occurrence or a component; default: everything | |
| units | No | Units of surface_deviation and max_edge_length | mm |
| binary | No | Binary STL (false: ASCII); STL only | |
| format | No | Format; default from the extension | |
| overwrite | No | Replace an existing file (it is deleted before the export) | |
| file_units | No | Units written to STL/OBJ (3MF has none) | mm |
| refinement | No | Tessellation quality; custom uses the values below | medium |
| aspect_ratio | No | Custom only: max triangle aspect ratio | |
| max_edge_length | No | Custom only: max edge length (units) | |
| normal_deviation | No | Custom only: max normal deviation, degrees | |
| surface_deviation | No | Custom only: max surface deviation (units) |