Skip to main content
Glama

Export a STEP file

export_step
DestructiveIdempotent

Write a faceted STEP file from a completed topology optimization run, or estimate face count, file size, time, and memory first without changing inputs.

Instructions

Write a faceted STEP file of a finished run (extra step: OpenCASCADE). Post-only: no pass runs and no input file changes. Same as topopt step.

The call is synchronous: it returns when the file is written, and a large export holds the call for minutes. Call it with estimate_only first for a large mesh: the estimate gives the time before the work starts. Cost (Linux x86_64): the cost follows the number of faces after the simplification, and that follows the part. A hook gives 9,000 to 36,000 faces with the default tolerance: 10 to 40 MB, 12 to 40 s, about 1 GB. A larger part with 85,000 faces took 102 s and 1.8 GB; another with 356,000 faces took 613 s (10 minutes) and 5.8 GB, and the file was 402 MB. tolerance_mm=0 keeps every triangle: about 1.1 KB, 1 ms and 16 KB of memory for each triangle (322,000 triangles: 363 MB, 6 minutes, 5.5 GB). run_dir: the run folder (relative paths start at the work folder; default: the last run). It wraps result/final.stl, or result/part_only.stl with part_only. Output: result/final.step (result/part_only.step) and its report next to it, result/final.step.json (result/part_only.step.json). out is another file path or an existing folder; the report is then next to that file (.json), so the run folder gets no file. An existing file is replaced only when it is a .step or .stp file; the input STL and any other existing file give an error with the options. estimate_only: simplify, count the faces and estimate size, time and memory; nothing is written. It works without OpenCASCADE. A failed check is a fact and the file is still written (exit_code 3). Without the extra the reply is {"ok": false, "missing_extra": "step", "install_command": ..., "error": ...}. Any other failure is {"ok": false, "error": ..., "exit_code": ...}. tolerance_mm: the simplification of the mesh (manifold3d), the largest move of the surface in mm; 0 = none. Default: the voxel size of the run / 20 (0 when the run folder holds no voxel size). A larger value gives fewer faces and a smaller, faster file; a value that removes every triangle is an error and no file is written. merge_planes: coplanar faces join into one planar face (the frozen plates). schema: AP214 (default) or AP242 (ap-242 and ap242 also work). The faces are the facets of the mesh, so a CAD program can cut holes in the solid and join it to other parts; it cannot edit the surfaces. The reply is the report: input (triangles, volume), settings (tolerance_mm and where it comes from), simplify, merge_planes, build (bodies, voids, and the check of the model in memory), model (the file read back: solids, faces, edges), volume (STEP against STL), deviation (sampled distance in both directions: max and mean, in mm), checks (read_back, topology, before_write, valid_solid, closed, units, schema: pass or fail with a reason; none has a threshold), checks_failed, options, timing_s, peak_rss_bytes. The reply of any other failure has the first line of stdout when there is one, and "signal" when the child process was killed.

Input Schema

NameRequiredDescriptionDefault
outNo
schemaNoAP214
run_dirNo
part_onlyNo
merge_planesNo
tolerance_mmNo
estimate_onlyNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.0

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare mutation, non-idempotent-looking write, and destructive=true, but the description adds far more: the call is synchronous and can block for minutes, concrete cost ranges in faces/MB/seconds/RAM, the fact that an existing .step/.stp is replaced while other existing files error, and that a failed check still writes the file with exit_code 3. These are behavioral facts an agent cannot derive from the annotations or schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose and scope, and nearly every sentence carries operational information. The cost paragraph is somewhat over-detailed—three separate benchmark anecdotes (9k–36k faces, 85k faces, 356k faces) could be compressed to a range plus the note that cost scales with face count—which costs some scannability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, and the description compensates by enumerating the report fields (input, settings, build, model, volume, deviation, checks, timing_s, peak_rss_bytes) plus the two failure reply shapes. Combined with 7 fully explained parameters and the cost model, an agent has everything needed to invoke, budget, and interpret this tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description carries the entire burden and does: it defines run_dir defaults and path resolution, out semantics and where the report lands, part_only's effect on input/output filenames, tolerance_mm's meaning (largest surface move in mm), its default derivation (voxel size / 20), and its edge case (removing every triangle is an error), plus merge_planes and schema (AP214/AP242 aliases) and estimate_only.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and resource ("Write a faceted STEP file of a finished run") plus an explicit scope restriction ("Post-only: no pass runs and no input file changes") and a CLI equivalence ("Same as `topopt step`"). An agent can distinguish this from a STL/other-format export or from run_mesh/verify_run siblings without reading the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit recommended workflow ("Call it with estimate_only first for a large mesh") with the reason (the estimate gives time before work starts), states the precondition (a finished, post-processing run), and states exclusions (no pass runs, no input file changes, existing non-.step files give an error). That is when-to-use, when-not-to-use, and a prerequisite in one place.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.