Describe a mechanical part in natural language β get a 3D model.
Pipeline: User input β GPT-4o-mini β Structured JSON β CadQuery β STL β Three.js viewer
- Python 3.10 or 3.11
- pip
cd backend
pip install -r requirements.txtNote: CadQuery requires a compatible platform wheel. If installation fails, try:
conda install -c cadquery -c conda-forge cadquery
Create a .env file in the project root (next to backend/):
OPENAI_API_KEY=sk-proj-...
cd backend
uvicorn main:app --reload --port 8000Navigate to http://localhost:8000
- Type a part description (e.g. "A cylinder 40mm diameter, 80mm tall")
- The AI may ask 1β3 clarifying questions
- Once confirmed, a 3D model appears in the viewer
- Iterate: "Make the hole bigger", "Add a flat base", etc.
- Download the STL with the Download STL button
IA2CAD/
βββ backend/
β βββ main.py β FastAPI app + routes
β βββ ai_service.py β OpenAI calls + JSON extraction
β βββ cad_generator.py β JSON β CadQuery β STL
β βββ session.py β in-memory session store
β βββ requirements.txt
β βββ output/ β generated STL files (auto-created)
βββ frontend/
β βββ index.html
β βββ app.js β chat + Three.js viewer
β βββ style.css
βββ .env β your API key (not committed)
βββ .env.example
βββ README.md
| Type | Parameters |
|---|---|
box |
width, depth, height (mm) |
cylinder |
diameter, height (mm) |
hole |
diameter, position [x, y] from center (mm) |
All features are centered at origin. Holes are drilled along the Z-axis.