Chat with FreeCAD in natural language. Powered by Ollama (Qwen2.5-Coder 32B) + AnythingLLM RAG.
You: "Create a gear with 20 teeth, 50mm diameter"
→ RAG fetches FreeCAD API docs
→ Qwen2.5-Coder generates Python code
→ Code executes live in FreeCAD
→ 3D model appears ✅
- Windows 10/11 or Ubuntu/Debian Linux
- NVIDIA RTX 3090 (24GB VRAM)
- FreeCAD installed
- Python 3.10+
- Internet connection (for first-time model download ~20GB)
# 1. Unzip and open folder in PowerShell
cd freecad-ai-agent
# 2. Run one-shot setup
powershell -ExecutionPolicy Bypass -File setup.ps1# 1. Clone / unzip this repo
cd freecad-ai-agent
# 2. Run one-shot setup (installs everything)
chmod +x setup.sh
./setup.sh
# 3. Configure AnythingLLM
# ~/AnythingLLM.AppImage
# Settings → LLM: Ollama → qwen2.5-coder:32b
# Settings → Embeddings: Ollama → nomic-embed-text
# Create workspace: "freecad"
# Settings → Get API key → copy it
# 4. Add your API key
cp config.example.json config.json
nano config.json # paste AnythingLLM API key
# 5. Scrape + index FreeCAD docs
source venv/bin/activate
python scrape_freecad.py
# Then in AnythingLLM → workspace → Add Data → Local Folder → freecad_docs/
# 6. Load FreeCAD macro
# Open FreeCAD
# Macro → Macros → Browse → macros/ai_listener.py → Execute
# (Console should say: AI Agent Listener started on localhost:9999)
# 7. Start the agent
python freecad_agent.pyYou: create a 100x50x30mm box
You: add a 15mm cylindrical hole through the center vertically
You: fillet all top edges with 3mm radius
You: export to /home/user/model.step
You: make the box twice as tall
| Command | Action |
|---|---|
exit |
Quit the agent |
clear |
Clear conversation history |
noexec |
Toggle auto-execute on/off |
You (chat)
↓
freecad_agent.py
├── AnythingLLM (RAG) ← FreeCAD Wiki + GitHub docs
├── Ollama (Qwen2.5-Coder 32B) ← RTX 3090
└── FreeCAD socket bridge (port 9999)
↓
ai_listener.py (FreeCAD macro)
↓
FreeCAD Python API
↓
3D Model updates live
Ollama not running:
ollama serveModel not found:
ollama pull qwen2.5-coder:32bFreeCAD not connected:
- Open FreeCAD
- Macro → Macros → ai_listener.py → Execute
- Check FreeCAD console for "AI Agent Listener started"
AnythingLLM API key:
- Open AnythingLLM → Settings → API Keys → Generate
- Paste into config.json
freecad-ai-agent/
├── setup.sh # one-shot installer
├── freecad_agent.py # main agent (run this)
├── scrape_freecad.py # FreeCAD doc scraper
├── config.example.json # config template
├── config.json # your config (gitignored)
├── requirements.txt # Python dependencies
├── freecad_docs/ # scraped docs (auto-created)
└── macros/
└── ai_listener.py # FreeCAD macro