Export¶
llmcad can export bodies to STEP, STL, and GLB (binary glTF) formats.
export_step¶
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") |
export_stl¶
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 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