# CADDesigner: Conceptual CAD Model Generation with a General-Purpose Agent
Fengxiao Fan\* · Jingzhe Ni\* · Xiaolong Yin · Sirui Wang · Xingyu Lu · Qiang Zou · Ruofeng Tong · Min Tang · Peng Du†
Zhejiang University, China
(\* equal contribution, † corresponding author)
[](https://562590763.github.io/CADDesigner/files/CADDesigner.pdf)
[](https://www.sciencedirect.com/science/article/pii/S0010448526000576)
[](https://562590763.github.io/CADDesigner/)
[](https://github.com/562590763/CADDesigner-Code)
## News
- **2026.05**: CADDesigner is published in *Computer-Aided Design*.
- **Code release**: This repository contains the public implementation and setup instructions.
## Abstract
Computer-Aided Design (CAD) plays a pivotal role in industrial manufacturing but typically requires a high level of expertise from designers. To lower the entry barrier and improve design efficiency, CADDesigner presents an LLM-powered general-purpose agent for conceptual CAD design. The agent accepts textual descriptions and sketches as input, interacts with users to refine and clarify design requirements, and generates executable CAD modeling code.
CADDesigner is built around the **Explicit Context Imperative Paradigm (ECIP)**, which makes modeling context, intermediate state, and operation intent explicit during code generation. During generation, the agent uses execution feedback and rendered visual feedback to repair the CAD program iteratively. Generated design cases can be stored in a structured knowledge base, providing a path for continual improvement of CAD code generation.
## Highlights
- **Natural-language CAD modeling**: describe a CAD model in text and let the agent generate executable modeling code.
- **Sketch-aware conceptual design**: use sketch or image references together with text prompts.
- **Requirement refinement**: expand vague user requests into structured modeling specifications before code generation.
- **ECIP-based CAD code generation**: represent modeling context and operation state explicitly for more reliable code synthesis.
- **Execution and automatic repair**: run generated code, inspect errors, and repair common CAD modeling failures.
- **Visual feedback loop**: compare rendered model views with the design requirement and revise the model when needed.
- **Interactive development**: support command-line use, API service mode, and a React Web UI.
- **File and artifact management**: save generated scripts, STEP/STL files, rendered images, and conversation context.
## Method Overview
CADDesigner follows a ReAct-style agent workflow for conceptual CAD generation:
1. **Receive Requirement**: the user provides a text prompt and optionally a sketch or reference image.
2. **Requirement Expansion**: a specialist subagent expands the request into dimensions, constraints, assumptions, APIs, and an ordered modeling process.
3. **Code Generation**: CADDesigner produces executable CAD modeling code with explicit context and operation intent.
4. **Execution and Export**: the generated script is executed and exports STEP/STL artifacts.
5. **Error Handling**: tracebacks and missing artifacts trigger automatic repair.
6. **Visual Feedback**: rendered views are checked against the user intent.
7. **Task Completion**: final scripts and exported model artifacts are returned to the user.
## ๐ Features
- **Natural-language CAD modeling**: describe a 3D model in plain language and let the agent generate accurate CAD code.
- **Multi-framework support**: supports CADQuery, SimpleCADAPI, PythonOCC-related workflows, and extensible CAD tooling.
- **Interactive development**: generate, execute, inspect, and debug CAD code in an iterative loop.
- **Intelligent query expansion**: automatically expands ambiguous requirements into detailed modeling specifications.
- **File management**: built-in file tools help save, inspect, and organize generated models.
- **Error handling and automatic repair**: detects common CAD modeling failures and attempts to repair them.
- **Web interface**: provides a FastAPI backend and React frontend for multi-session interaction.
### Core Components
1. **BaseAgent**: the main AI agent that coordinates the full workflow.
2. **Tools**: specialized tools for CAD code generation, file operations, command execution, rendering, and feedback.
3. **Config**: manages LLM provider configuration, API keys, and model routing.
4. **CLI Interface**: rich terminal-based interaction for local modeling.
5. **Web Interface**: FastAPI service and React UI for browser-based use.
6. **Skill References**: CAD API and workflow references used by specialist subagents under `workspace/skills/`.
## ๐ Prerequisites
### System Requirements
- Python 3.12, as specified in `pyproject.toml`
- Docker, if you want to use the bundled Redis service or full Docker deployment
- Node.js and pnpm, if you want to run the React frontend in development mode
### Required Python Packages
This project uses [uv](https://github.com/astral-sh/uv) for fast and reliable dependency management.
Install all dependencies with:
```bash
uv sync
```
In the development environment, `pyproject.toml` and `uv.lock` are the source of truth for dependencies. The committed `requirements.txt` is exported from `uv.lock` for Docker and deployment environments.
## โ๏ธ Configuration
### 1. Environment Variables
The project reads environment variables from a `.env` file in the repository root. Create one from the provided template:
```bash
cp docker/env.example .env
```
Configurable variables include:
- **Redis configuration**
- `REDIS_DB`: Redis database index
- `REDIS_PASSWORD`: Redis password
- `REDIS_HOST`: Redis host
- `REDIS_PORT`: Redis port
- **Storage configuration**
- `CONTEXT_DIR`: context storage directory
- `CONTEXT_AUTO_SUMMARIZE_TRIGGER`: automatic summarization threshold, defaulting to `1000000`, which effectively disables automatic summarization
- `SKETCH_DIR`: SketchPad storage directory
- **Observability configuration, optional**
- `LANGFUSE_SECRET_KEY`: Langfuse secret key
- `LANGFUSE_PUBLIC_KEY`: Langfuse public key
- `LANGFUSE_BASE_URL`: Langfuse service URL
### 2. LLM Provider Configuration
Generate the provider configuration file from the template and then edit it:
```bash
cp config/provider_template.json config/provider.json
```
Edit `config/provider.json` with your own provider settings and API keys:
```json
{
"volc_engine": [
{
"model_name": "deepseek-v3-250324",
"api_keys": ["your_api_key_here"],
"base_url": "https://ark.cn-beijing.volces.com/api/v3/",
"max_retries": 3,
"retry_delay": 1
}
],
"openrouter": [
{
"model_name": "anthropic/claude-sonnet-4.6",
"api_keys": ["your_api_key_here"],
"base_url": "https://openrouter.ai/api/v1"
},
{
"model_name": "google/gemini-3.1-pro-preview",
"api_keys": ["your_api_key_here"],
"base_url": "https://openrouter.ai/api/v1"
},
{
"model_name": "google/gemini-3-flash-preview",
"api_keys": ["your_api_key_here"],
"base_url": "https://openrouter.ai/api/v1"
}
]
}
```
Do not commit real API keys.
### 3. LLM Interface Configuration
The agent uses different LLM interfaces for different tasks:
- **BASIC_INTERFACE**: general conversation and coordination
- **CODE_INTERFACE**: CAD code generation and repair, usually requiring a stronger model
- **QUICK_INTERFACE**: query expansion and lightweight tasks
These routes are configured in `config/config.py` and `config/provider.json`.
## ๐ Quick Start
### Installation
1. Clone the repository:
```bash
git clone https://github.com/562590763/CADDesigner-Code.git
cd CADDesigner
```
2. Install dependencies:
```bash
uv sync
```
3. Install the repository Git hook, optional for development:
```bash
./scripts/install_git_hooks.sh
```
The hook automatically runs `uv export` before commits, refreshing and staging `requirements.txt`.
4. Configure your LLM provider as described above.
5. Start Redis, required by the backend.
The backend uses Redis in CLI, API, and Web modes. By default, the configuration reads `REDIS_HOST=localhost` and `REDIS_PORT=9736` from `.env`. If you do not already have a local Redis instance, use the bundled Docker Compose file:
```bash
# Start local development Redis
docker compose -f docker/docker-compose.redis.yml up -d
# Check Redis status
docker compose -f docker/docker-compose.redis.yml ps
# Stop and remove the Redis container
docker compose -f docker/docker-compose.redis.yml down
```
You can also verify Redis manually:
```bash
docker compose -f docker/docker-compose.redis.yml ps
redis-cli -p 9736 ping
```
### Run the Agent
#### Method 1: Command-Line Interface
Start interactive CADDesigner:
```bash
LOG_LEVEL=WARNING uv run python main.py
# Press Ctrl+D after finishing multi-line input
```
#### Method 2: Web Interface, Recommended
The current Web stack uses a FastAPI backend and a React frontend.
**Option A: one-command startup, recommended**
```bash
# Start both the API server and the React Web UI
uv run python start_caddesigner_full.py
```
**Option B: start services separately**
```bash
# Terminal 1: start the API server
uv run python start_caddesigner_api.py
# Terminal 2: start the Web UI
uv run python start_caddesigner_ui.py
```
Access the Web interface:
- **Local React Web UI**: