Skip to content

Export

llmcad can export bodies to STEP, STL, and GLB (binary glTF) formats.

export_step

export_step(body, path: str) -> str

Export to STEP format (AP214). This is the standard CAD interchange format supported by all major CAD software.

Parameter Description
body Body to export
path Output file path (e.g. "part.step")
from llmcad import Box, export_step

plate = Box(100, 60, 10)
export_step(plate, "plate.step")

export_stl

export_stl(body, path: str, deflection: float = 0.05) -> str

Export to STL format. Commonly used for 3D printing.

Parameter Description
body Body to export
path Output file path (e.g. "part.stl")
deflection Mesh quality --- smaller = finer mesh (default: 0.05)
from llmcad import Box, export_stl

plate = Box(100, 60, 10)
export_stl(plate, "plate.stl")

# Higher quality mesh for 3D printing
export_stl(plate, "plate_hq.stl", deflection=0.01)

export_glb

export_glb(body, path: str, deflection: float = 0.05) -> str

Export to GLB (binary glTF 2.0) format. Ideal for web viewers like three.js and <model-viewer>.

Parameter Description
body Body to export
path Output file path (e.g. "part.glb")
deflection Mesh quality --- smaller = finer mesh (default: 0.05)

The exported GLB includes:

  • Mesh geometry with per-vertex normals
  • PBR material with the body's color
from llmcad import Box, export_glb

plate = Box(100, 60, 10, color="steel")
export_glb(plate, "plate.glb")

Format comparison

Format Use case Preserves geometry? File size
STEP CAD interchange, editing in other tools Yes (exact B-Rep) Large
STL 3D printing, simulation No (triangulated) Medium
GLB Web viewers, AR/VR, visualization No (triangulated) Small

When to use which

  • STEP if you need to import into another CAD tool (Fusion 360, SolidWorks, FreeCAD)
  • STL if you're 3D printing
  • GLB if you're displaying in a web browser or need a compact file