A minimal, LLM-friendly CAD library in Python.
Documentation: https://llmcad.org
Source Code: https://github.com/llmcad/llmcad
llmcad is a Python CAD library designed from the ground up to be LLM-friendly. It wraps OpenCASCADE (via OCP) with a minimal, explicit API that makes 3D modeling predictable and debuggable — whether you're writing code yourself or letting an AI agent do it.
Developed by and powering BuildCAD AI — the #1 Text-to-CAD tool.
Why llmcad?
LLMs struggle with 3D spatial reasoning. Traditional CAD APIs make this worse with large surface areas, implicit state, and global coordinate math.
llmcad fixes this with three design principles:
- Named geometry: Every face and edge has a semantic name (
top,front,left_edge). No guessing indices or filtering by coordinates. - Face-local coordinates: Position things relative to faces using intuitive local offsets (
offset,inset). No global coordinate math. - Minimal API: ~28 core concepts. If an LLM can't hold the entire API in context, the API is too big.
Key Features
- Shapes —
Box,Cylinder,Spherecentered at origin with named faces - Sketches —
Rect,Circle,Ellipse,Polygon,Text, and turtle-styleSketchbuilder - Operations —
extrude,revolve,loft,sweep,fillet,chamfer,shell,split,mirror - Assembly —
placeparts on faces,Assemblyfor multi-part models - Booleans —
+(union),-(cut),&(intersect) — operator syntax, no method chains - Visual debugging — Multi-view
snapshot()renders for LLM feedback loops - Export —
export_step,export_stl,export_glbfor CAD interchange, 3D printing, and web viewers - Immutable — Boolean ops return new bodies. No hidden mutation.
Installation
pip install llmcad
Requires Python 3.10+. Dependencies (cadquery-ocp, numpy, Pillow, vtk) are installed automatically.
Quick Example
A mounting plate with a boss, through-hole, filleted edges, and corner mounting holes — in 15 lines:
from llmcad import Box, Rect, Circle, extrude, fillet
# Base plate
plate = Box(100, 60, 10, color="steel")
# Raised boss on top
boss = extrude(Rect(30, 30).place_on(plate.top), amount=20)
plate = plate + boss
# Through-hole in boss
hole = extrude(Circle(12).place_on(plate.top), through=True)
plate = plate - hole
# Fillet top edges
plate = fillet(plate.top.edges, radius=3)
# Corner mounting holes
for corner in plate.bottom.corners:
pos = corner.inset(dx=8, dy=8)
h = extrude(Circle(5).place_on(plate.bottom, at=pos), through=True)
plate = plate - h
How It Works
Named Faces
Every shape comes with semantic face names. No need to filter by normal direction or index into face lists.
box = Box(60, 40, 20)
box.top # +Z face
box.bottom # -Z face
box.front # -Y face
box.back # +Y face
box.left # -X face
box.right # +X face
Face-Local Positioning
Place sketches and holes relative to faces using local coordinates. offset(dx, dy) moves in the face's local frame — dx is always "right" and dy is always "up", regardless of which face you're on.
# Hole offset 20mm to the right on the top face
pos = plate.top.center.offset(dx=20)
hole = extrude(Circle(5).place_on(plate.top, at=pos), through=True)
# Holes at each corner, inset 8mm from edges
for corner in plate.top.corners:
pos = corner.inset(dx=8, dy=8) # direction toward center is automatic
Boolean Operations
Combine bodies with Python operators. Each operation returns a new body — the originals are unchanged.
base = Box(80, 60, 10)
boss = extrude(Rect(30, 30).place_on(base.top), amount=20)
result = base + boss # union
result = base - boss # cut
result = base & boss # intersect
Visual Debugging
Render multi-view snapshots for visual verification — essential for LLM feedback loops.
from llmcad import snapshot
snapshot(plate, "plate") # saves plate.png with front, right, top, and iso views
More Examples
| Box |
Cylinder |
Sphere |
| Plate with Hole |
Filleted Edges |
Chamfered Edges |
| Boolean Subtraction |
Corner Holes |
Stacked Boxes |
See the full examples gallery for all 18 examples with code.
Export
Export to STEP (CAD interchange), STL (3D printing), or GLB (web viewers):
from llmcad import Box, export_step, export_stl, export_glb
box = Box(50, 50, 50, color="steel")
export_step(box, "box.step") # exact B-Rep geometry
export_stl(box, "box.stl") # triangulated mesh
export_glb(box, "box.glb") # binary glTF 2.0 with PBR material
API at a Glance
| Category | Symbols |
|---|---|
| Shapes | Box, Cylinder, Sphere |
| Sketches | Rect, Circle, Ellipse, Polygon, Text, Sketch |
| Operations | extrude, revolve, loft, sweep, fillet, chamfer, shell, split, mirror |
| Assembly | place, Assembly, RevoluteJoint |
| Booleans | + (union), - (cut), & (intersect) |
| Debug | snapshot, show, show_faces, show_edges, measure |
| Export | export_step, export_stl, export_glb |
| Types | Body, FaceRef, EdgeRef, Position |
Full API reference: llmcad.org/api-reference
Dependencies
llmcad builds on:
- OCP — Python bindings for OpenCASCADE, the industry-standard open-source CAD kernel
- NumPy — array operations for tessellation and rendering
- Pillow — image output for snapshots
- VTK — offscreen multi-view rendering
License
This project is licensed under the terms of the MIT license.
Developed by and powering BuildCAD AI — the #1 Text-to-CAD tool.
Metadata
Release files for llmcad 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llmcad-0.3.0.tar.gz | 1.4 MB | Without provenance | Details for llmcad-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llmcad-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for llmcad-0.3.0-py3-none-any.whl |
Total release size: 1.4 MB
Release files / llmcad-0.3.0.tar.gz
| Download URL | llmcad-0.3.0.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aea857640ffaef7a91c7efbb36f569262c683d2ce387871991d78bfb152a981d
|
|
BLAKE2b-256 checksum How to use checksums |
d4efb5ae369d7a647f49831c4204c1029ab864b18c3005518fda64d477847407
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / llmcad-0.3.0-py3-none-any.whl
| Download URL | llmcad-0.3.0-py3-none-any.whl |
|---|---|
| Size | 34.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac0e23d753d7ddf006505bde1d56d8ab9314ff337c0dba703d0545d71fd40af5
|
|
BLAKE2b-256 checksum How to use checksums |
a9362222bb5c6e3dc4049b0b2d51daa7f179b518da489b4f6b77790c32e88ea4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for llmcad 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.