Alternative CAD Export Formats in Text-to-CAD: STL, GLB, and 3MF Beyond STEP

Text-to-CAD supports three alternative CAD export formats beyond STEP—STL for binary mesh output, GLB for web-ready 3D assets with materials and hierarchy, and 3MF for modern 3D printing workflows—each implemented as modular exporters in the cadpy package.

The earthtojake/text-to-cad repository generates precise CAD geometry from text prompts, but not every downstream workflow requires STEP files. Understanding the alternative CAD export formats available in the codebase helps you choose the right file type for 3D printing, web visualization, or manufacturing pipelines without losing geometric fidelity.

STL Export for Rapid Prototyping

The STL exporter converts CAD scenes into binary mesh format for universal 3D printing compatibility. Located in packages/cadpy/src/cadpy/stl.py, the primary function export_part_stl_from_scene generates binary STL files from the exported shape geometry.

Unlike STEP, which stores precise boundary representation (B-rep) data, STL produces a triangulated mesh optimized for slicing software. This makes it ideal for rapid prototyping workflows where mesh-based toolpaths are required, though it lacks the parametric editing capabilities of native CAD formats.

GLB Export for Web Visualization and Assembly Hierarchy

For web-based viewers and real-time rendering, Text-to-CAD provides comprehensive GLB (binary glTF) support through packages/cadpy/src/cadpy/glb.py. This module contains three distinct export functions:

  • export_part_glb_from_scene – Generates a GLB file for single-part geometry with material definitions
  • export_assembly_glb_from_scene – Preserves full assembly hierarchies and component relationships in the exported scene
  • export_native_glb_from_scene – Exports using native glTF conventions for maximum web compatibility

GLB files encapsulate geometry, PBR materials, and scene graphs in a single binary payload, making them the optimal choice for browser-based CAD viewers or AR/VR applications. According to the source code, this is the only alternative format that maintains assembly structure.

3MF Export for Modern Additive Manufacturing

The 3MF exporter in packages/cadpy/src/cadpy/threemf.py implements the export_part_3mf_from_scene function for modern manufacturing workflows. This format stores mesh data alongside print metadata—including support structures, slicer settings, and color information—in a standardized ZIP-based package.

3MF addresses the limitations of STL by supporting:

  • Multiple materials per part
  • Lattice structures and beam extensions
  • Thumbnail previews and digital rights management

This makes 3MF the preferred alternative when targeting professional additive manufacturing equipment that requires rich metadata beyond pure geometry.

Programmatic Usage of Alternative Exporters

The generation pipeline in cadpy/generation.py orchestrates these exporters based on user CLI flags defined in skills/cad/scripts/step/cli.py. You can also invoke them directly in Python to batch-convert generated geometry:

from pathlib import Path
from cadpy.step_export import export_build123d_step_scene
from cadpy.stl import export_part_stl_from_scene
from cadpy.glb import export_part_glb_from_scene
from cadpy.threemf import export_part_3mf_from_scene
from cadpy.generation import generate_cad  # high-level entry point

# Example: generate all supported formats for a part

source_step = Path("models/example.step")
output_dir = Path("out")

# STEP (default)

scene = export_build123d_step_scene(to_export=my_part, output_path=output_dir / "example.step")

# STL

stl_path = export_part_stl_from_scene(source_step, scene, target_path=output_dir / "example.stl")

# GLB

glb_path = export_part_glb_from_scene(source_step, scene, target_path=output_dir / "example.glb")

# 3MF

mf3_path = export_part_3mf_from_scene(source_step, scene, target_path=output_dir / "example.3mf")

Each function accepts a source STEP path, the scene object, and a target file path, ensuring consistent API design across all alternative CAD export formats.

Summary

Frequently Asked Questions

What alternative CAD export formats does Text-to-CAD support besides STEP?

According to the earthtojake/text-to-cad source code, the system natively supports STL for binary mesh output, GLB for web-ready 3D assets, and 3MF for manufacturing workflows. These are implemented in stl.py, glb.py, and threemf.py respectively within the packages/cadpy/src/cadpy/ directory.

Which export format should I use for 3D printing applications?

Use 3MF for modern additive manufacturing, as it stores mesh data, print metadata, and material specifications in a standardized package defined by the 3MF Consortium. Alternatively, STL provides universal compatibility with legacy slicing software and FDM printers, though it lacks the rich metadata and color support of 3MF.

Does Text-to-CAD preserve assembly hierarchies in alternative export formats?

Yes, but only in GLB exports. The export_assembly_glb_from_scene function in packages/cadpy/src/cadpy/glb.py specifically handles assembly hierarchies and component relationships, while the STL and 3MF exporters in the current implementation target part-level geometry without maintaining full scene graphs.

How do I programmatically export a generated CAD model to multiple formats?

Import the specific exporter functions from their respective modules—export_part_stl_from_scene, export_part_glb_from_scene, and export_part_3mf_from_scene—and invoke each with the source STEP path, scene object, and target file path. The cadpy/generation.py module demonstrates this pattern when orchestrating multi-format outputs based on CLI arguments.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →