Text-to-CAD Output Capabilities: STEP, STL, 3MF, and GLB Export Guide
Text-to-CAD exports parametric geometry as STEP files first, then derives STL, 3MF, and GLB formats through a unified Python build123d workflow or a JavaScript implicit CAD runtime.
The earthtojake/text-to-cad repository organizes natural-language CAD generation as a skill library with robust output capabilities. According to the canonical skill definition in skills/cad/SKILL.md, the system treats STEP as the primary source of truth, with all other formats generated through explicit export pipelines to ensure geometric fidelity.
Primary Output Formats and Architecture
The repository implements a hierarchical output strategy where secondary formats are always derived from a single authoritative source.
STEP as the Source of Truth
The CAD skill declares STEP (.step or .stp) as the mandatory primary artifact. This format preserves parametric boundary representation (B-rep) data, enabling precise measurements and edits in professional CAD tools. The generation path relies on build123d Python scripts invoked via the CLI.
To generate a STEP file from a build123d source file:
python scripts/step my_part.py --kind part --output my_part.step
This command processes the Python generator and emits a standards-compliant STEP file that serves as the foundation for all downstream exports.
Derived Secondary Formats
The scripts/step utility supports on-the-fly conversion to mesh formats using the --format flag. Secondary outputs include STL (tessellated geometry), 3MF (modern manufacturing format), and GLB (compressed glTF for web viewing).
Export to alternative formats from the primary STEP:
# Export to STL
python scripts/step my_part.py --kind part --format stl --output my_part.stl
# Export to 3MF
python scripts/step my_part.py --kind part --format 3mf --output my_part.3mf
# Export to GLB
python scripts/step my_part.py --kind part --format glb --output my_part.glb
All conversions maintain the coordinate system and units defined in the source build123d script.
Python Workflow with build123d
The core Python workflow follows a three-stage pipeline: generation, validation, and snapshot. These stages are enforced by the skill definition to ensure output quality before hand-off to viewers.
Generating STEP Files
The entry point scripts/step accepts either a Python file containing build123d code or an existing STEP file for re-export. When provided with Python source, it executes the script within a controlled environment that exposes the build123d API.
The CLI signature follows this pattern:
python scripts/step <source> --kind <part|assembly> --output <path> [--format <step|stl|3mf|glb>]
If the source is an existing .step or .stp file, the script imports the geometry and applies the requested format conversion without re-executing parametric code. For a complete end-to-end example, see benchmarks/01-rectangular-calibration-block.md, which demonstrates a natural language prompt resulting in a validated STEP output.
Validating Geometry with Inspection Scripts
Before final export, the scripts/inspect tool validates geometry, selectors, and measurements against design specifications. This script is invoked automatically during the skill workflow to catch topological errors.
Run an inspection with full fact reporting:
python scripts/inspect refs my_part.step --facts --planes --positioning
The inspection generates a validation report that includes face references, plane alignments, and dimensional positioning, ensuring the exported artifact matches the design intent defined in skills/cad/SKILL.md.
Creating Visual Snapshots
The scripts/snapshot utility produces PNG renderings of the STEP geometry for documentation and verification. This step is mandatory before handing off to the CAD viewer.
Generate a snapshot:
python scripts/snapshot my_part.step --output /tmp/my_part_snapshot.png
The snapshot captures the current view state and saves a high-resolution image suitable for pull request previews or automated reporting pipelines.
JavaScript Implicit CAD Workflow
For browser-native implicit modeling, the repository provides packages/implicitjs, a standalone JavaScript runtime documented in packages/implicitjs/README.md that renders signed distance functions (SDFs) using Three.js.
Exporting Meshes from Implicit Models
The implicit workflow uses .implicit.js modules that define mathematical geometry rather than parametric features. The runtime tessellates these implicit surfaces into standard meshes.
Export an implicit model to GLB using npm:
npm run export -- --input examples/model.implicit.js --format glb --output /tmp/model.glb
Supported export formats include STL, 3MF, and GLB, specified via the --format parameter. The runtime handles adaptive meshing to balance file size and surface accuracy.
Rendering Preview Images and GIFs
The implicitjs package supports orbital GIF generation and static PNG snapshots for documentation.
Generate an orbital preview GIF:
npm run snapshot -- --input examples/model.implicit.js --output /tmp/model.gif --mode orbit
This creates a rotating animation suitable for README files and design reviews, distinct from the static snapshots produced by the Python workflow.
CAD Viewer Integration and Hand-off
Every CAD workflow concludes with a mandatory hand-off to the $cad-viewer skill. As defined in skills/cad/SKILL.md (lines 76-78), this step launches a local web UI that loads the generated STEP file and returns a shareable URL.
Invoke the viewer from the CLI:
$cad-viewer /path/to/my_part.step
Example response:
Viewer URL: https://viewer.cadskills.xyz/?dir=/absolute/path/to/models&file=my_part.step
The viewer supports real-time sectioning, measurement tools, and format conversion verification. The integration script at scripts/viewer/sync-cad-viewer-repo.sh ensures the local viewer client remains synchronized with the latest rendering engine.
Summary
- STEP is the primary format: All workflows in
skills/cad/SKILL.mdtreat STEP as the source of truth, with STL, 3MF, and GLB derived through explicit conversion flags. - Two distinct pipelines: Python build123d workflows use
scripts/step,scripts/inspect, andscripts/snapshot, while implicit CAD usespackages/implicitjswithnpm run export. - Validation is mandatory: The
scripts/inspecttool validates geometry before export, andscripts/snapshotcreates visual verification artifacts. - Viewer hand-off required: Every workflow must conclude with
$cad-viewerto generate a shareable web link for the output file.
Frequently Asked Questions
What is the primary output format in Text-to-CAD?
STEP (.step or .stp) is the canonical output format according to skills/cad/SKILL.md. The architecture treats STEP as the single source of truth because it preserves parametric boundary representation (B-rep) data required for precise manufacturing. All mesh formats (STL, 3MF, GLB) are derived from this primary file to prevent geometric divergence.
How do I convert a STEP file to STL or GLB?
Use the scripts/step CLI with the --format flag. For STL conversion, run python scripts/step input.step --format stl --output model.stl. For GLB, use --format glb. Alternatively, if working from Python source, pass the format directly during initial generation: python scripts/step model.py --format glb --output model.glb.
What is the difference between the Python and JavaScript workflows?
The Python workflow (scripts/step) uses build123d for parametric feature-based modeling and exports STEP files as the primary artifact. The JavaScript workflow (packages/implicitjs) uses implicit functions (SDFs) defined in .implicit.js modules for browser-native rendering, exporting meshes directly without an intermediate STEP file. Python is suited for mechanical CAD with precise dimensions, while JavaScript handles organic shapes and web-native visualization.
How does the CAD Viewer integration work?
The $cad-viewer skill automatically launches a local web server that loads the generated STEP file into a Three.js-based viewer. As documented in skills/cad/SKILL.md, this hand-off is mandatory for every CAD workflow. The viewer returns a URL like https://viewer.cadskills.xyz/?dir=/path&file=model.step that can be shared for collaborative review, and it supports real-time measurements and section analysis.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →