freecad-chatcad 发布 FreeCAD 智能体侧边栏,支持 Claude Code、Codex 与本地模型
Vittuu/freecad-chatcad
Vittuu/freecad-chatcad 发布 FreeCAD 的 AI 智能体侧边栏 Chat CAD,用户描述零件、点选面或在 3D 视图上涂画,智能体即生成可手动继续调整的参数化 FreeCAD 文档。
Chat CAD for FreeCAD
An AI agent side panel for FreeCAD. Describe a part, point at a face, or scribble on the 3D view, and an agent models it for you as a parametric FreeCAD document you can keep tweaking by hand.
Pick the agent you like: Claude Code, OpenAI Codex, Google Antigravity, or a local model through Ollama (or any OpenAI-compatible server such as LM Studio), on your own computer or on another PC of yours with a GPU.
Status: alpha. Tested on Windows 11 with FreeCAD 1.1.4. Linux and macOS should work but are untested. The interface is in Brazilian Portuguese (translations welcome).
Warning
Local AI is not there yet. The local provider works and is fully integrated, but in our tests local models (qwen3:8b, qwen3.5:9b, qwen3.8:27b, on a laptop CPU and on a desktop GPU) only handled simple parts; every real multi-feature part failed, even when asked one feature at a time. For real work, use Codex, Claude Code or Antigravity. See Tests for the numbers and photos.
Features
- Agent panel docked inside FreeCAD with a minimal dark/light UI that follows FreeCAD's theme: starting-point cards, quick actions, collapsible step cards that show what the agent ran (input and output), formatted answers, and a footer with time and tokens/s. Toggle it with
Ctrl+Shift+Space. - Four providers: Claude Code, Codex and Antigravity use your existing CLI login/subscription (no API keys stored by the addon). The local provider talks to Ollama or an OpenAI-compatible server directly from FreeCAD: nothing leaves your machine (or your private network).
- Point and ask: whatever you select in the 3D view (faces, edges, picked points) goes along with your message ("make a 5 mm hole here"). One click ignores the selection.
- Draw what you mean: capture the 3D view and scribble on it (pen, line, arrow, text, colors, undo/redo), start from a blank grid sheet, or paste/drag any image.
- Parametric by default: dimensions live in a
Parametrosspreadsheet with aliases; change a number and pressCtrl+R. - Safety nets: a backup copy (
<name>.antes-<action>.FCStd) before changes, each local-agent step is one undo entry (Ctrl+Z), failed steps are rolled back automatically, and an automatic check (valid single solid, no broken objects) runs before the agent may say "done". - Agent / Plan modes: Agent edits the model; Plan only discusses and proposes.
How it works
┌─ CLI providers ──> claude -p / codex exec / agy -p ──> freecad-mcp (uvx) ──┐
FreeCAD ── Chat CAD ───┤ ├─> FreeCAD
panel └─ Local provider ──> Ollama / OpenAI-compatible HTTP ──> tools run in-process ┘
- CLI providers run the agent CLI headless, stream its JSON events into the chat, and give it exactly one MCP server: freecad-mcp, which drives the running FreeCAD.
- Local provider runs its own agent loop inside FreeCAD (no CLI, no MCP): a small, fixed tool set (
run_python,get_document,set_parameter,view_screenshot), short Portuguese prompts tuned for 4–30B models, helpers such asparam(),liga(),arestas()andarredonda(), error hints in Portuguese, and guards against the classic small-model failures (tool calls written as text, code shown instead of run, promising an action and stopping, answers cut by the length limit, the same failing call repeated).
Requirements
- FreeCAD 1.0+ (tested with 1.1.4).
- For the CLI providers: uv (to run
freecad-mcpwithuvx) and the freecad-mcp FreeCAD addon: copyaddon/FreeCADMCPfrom neka-nat/freecad-mcp into your FreeCADModfolder, restart FreeCAD, switch to the MCP Addon workbench and enable FreeCAD MCP → Auto-Start Server. Then at least one CLI, logged in:- Claude Code: run
claudeonce and/login. - Codex CLI:
codex login. The panel passes its MCP config on the command line. - Antigravity CLI (
agy): log in once, then register the server and allow its tools (headless mode can't ask):agy mcp add freecad -- uvx --python ">=3.12" freecad-mcpand in~/.gemini/antigravity-cli/settings.json:{ "permissions": { "allow": ["mcp(freecad/*)"] } }
- Claude Code: run
- For the local provider: Ollama with at least one model that supports tools, e.g.
ollama pull qwen3.5:9b(tools + vision). No MCP addon or uv needed. See Local models.
The panel shows a banner when the selected provider is missing, logged out or unreachable (with a Start Ollama button for the local one).
Installation
Option A: git clone into the Mod folder
git clone https://github.com/Vittuu/freecad-chatcad.git
Clone it into your FreeCAD user Mod folder, for example %APPDATA%\FreeCAD\v1-1\Mod\ on Windows or ~/.local/share/FreeCAD/v1-1/Mod/ on Linux, then restart FreeCAD. The panel opens on the left.
Option B: Addon Manager custom repository
Edit → Preferences → Addon Manager → Custom repositories: add https://github.com/Vittuu/freecad-chatcad with branch main, then install Chat CAD.
Local models
Not ready for real parts yet. Simple parts (a plate with holes, a box) and changing existing dimensions work. Real multi-feature parts failed with every local model we tried, on CPU and on GPU, even one feature at a time (results). The integration is in place so it gets better as local models improve; today, use a cloud agent for real work.
Open the gear (⚙) in the panel header to pick the server (Ollama or OpenAI-compatible), its address, a vision model for describing attached images when the main model can't see, the thinking mode, context size, step limit, and memory options (free the model's RAM after each answer).
Use a GPU if you can. On a laptop CPU, models run at 1–4 tokens/s: simple parts work, complex ones don't (see the tests below). If you have another PC with a GPU, run Ollama there and point Chat CAD to it. A safe way over Tailscale, without opening firewall ports or exposing Ollama to your LAN:
# on the GPU machine (Ollama keeps listening only on 127.0.0.1)
tailscale serve --bg --tcp=11434 tcp://127.0.0.1:11434Then, in Chat CAD's settings, set the address to http://<the GPU machine's Tailscale IP>:11434. Use the IP, not the MagicDNS name: when Ollama listens on localhost it rejects other host names with 403 (DNS-rebinding protection) but accepts the machine's own IP addresses.
Tests
1. The same simple part on every agent
"Crie uma placa de 60 x 40 x 5 mm com 4 furos de 5 mm nos cantos, a 6 mm das bordas." Each result was checked numerically: single valid solid, exact volume (11 607.3 mm³), hole centers, parameters.
| Agent | Model | Runs on | Time | Result |
|---|---|---|---|---|
| Codex | account default | cloud | 93 s | ✅ correct |
| Antigravity | Gemini 3.8 Flash (High) | cloud | 208 s | ✅ correct (first try hit a network error) |
| Local | qwen3:8b | laptop CPU (i7-1265U) | 221 s | ✅ correct, first try |
| Claude Code | Opus | cloud | 279 s | ✅ correct (PartDesign, self-corrected placement) |
| Local | qwen2.5:7b | laptop CPU | 323 s | ❌ holes in the wrong place |
| Local | qwen2.5:7b | desktop GPU (RX 7600) | 35 s | ❌ broken solid (fast, but same model quality) |
2. A real part from a text description
The wall-mount remote holder below was first modeled interactively with Chat CAD. Its features were then written down as one text description (basket, back plate with rounded top corners, countersunk screw holes, U-shaped front cut-out with rounded corners, curved side gussets, honeycomb vent, engraved text) and given to each agent in a new, empty document.
Every result was checked numerically against the original (34 589 mm³, 60 × 40 × 95 mm): single valid solid, volume, size, screw holes, countersinks, text, parameters.
3. Local models, one feature per message
Same part, split into 8 short messages in one conversation (basket, back plate, rounded corners, screw holes, U cut-out, gussets, honeycomb, text). The run stops at the first failed step.
| Model | Runs on | Speed | Result |
|---|---|---|---|
| qwen3:8b | laptop CPU | ~3 tok/s | ❌ step 2 (wrote text into App.Vector) |
| qwen3.5:9b | laptop CPU | 3.6 tok/s, ~15 min/step | ❌ step 2 |
| qwen3.5:9b | desktop GPU (RX 7600, all layers on GPU) | ~21–40 tok/s, ~1 min/step | ❌ step 3 (basket cavity barely cut; edge selection) |
| qwen3.8:27b | desktop GPU + CPU (28 % on GPU) | ~1 tok/s, ~9–15 min/step | ⚠️ steps 1–2 clean and valid, but it opened the front instead of the back; stopped after step 2 (too slow: all 8 steps would take well over an hour) |
Takeaways (honest):
- For real parts, today's cloud agents are far ahead. Codex was the fastest and most faithful in these tests.
- Local models handle simple parts and parameter tweaks; complex multi-feature parts still fail, even step by step. A GPU fixes speed (10–16× here), not reasoning.
- The automatic checks matter: they caught every broken local result, and numeric verification exposed a defect (Antigravity) that looked fine in a screenshot.
- Each local failure above became a fix in the agent (hints for the exact errors,
arestas()/arredonda()helpers, "promised but didn't run" and "answer cut by length" recovery).
Automated test suites
| Suite | What it covers | Result |
|---|---|---|
tests/test_llm.py |
prompt, stream parsers (Ollama NDJSON, OpenAI SSE), argument repair, tool calls leaked as text, history compaction, thinking modes | 31 / 31 |
tests/qt_test_agent.py |
local agent loop against a fake Ollama server: steps, stop, gates, nudges, vision bridge, prewarm | 61 / 61 |
tests/qt_test_backend.py |
CLI providers with fake executables: event parsing, errors, auth checks | 36 / 36 |
tests/qt_test_ui.py |
the panel offscreen, dark and light themes: every provider, conversation rendering, attachments, stop/queue, menus | 143 / 143 |
tests/fc_test_tools.py |
FreeCAD tools in freecadcmd: run/rollback/undo, timeouts, parameters, backups, verification, helpers |
78 / 78 |
Run them with FreeCAD's Python (QT_QPA_PLATFORM=offscreen, and a temporary FREECAD_USER_HOME); see each file's header. The pure tests also run with any Python: python -m unittest tests.test_llm.
Security
The agents run Python code inside your FreeCAD session with your user's permissions.
- Claude Code: only the
freecadMCP server is loaded (--strict-mcp-config); shell/edit/web tools are disallowed. - Codex: runs with the
read-onlysandbox; only thefreecadtools are pre-approved. - Antigravity: only
mcp(freecad/*)is allowed. - Local: tools run in-process; each step is a FreeCAD transaction (rolled back on error), infinite loops are stopped, and nothing is sent anywhere except the model server you configure.
Keep backups of important files; the addon makes one before every change.
Troubleshooting
- The panel doesn't appear at startup. Check
<FreeCAD user data>/chatcad_startup.log. Note that with apackage.xml, FreeCAD 1.x only runsInitGui.pyfor content declared as<workbench>(this addon does that, without creating a workbench). - A CLI agent "writes" tool calls as text, or says the FreeCAD tools are unavailable. The MCP server didn't start. FreeCAD puts its own Python (3.11) first on
PATH, whilefreecad-mcpneeds Python ≥ 3.12; the panel strips FreeCAD fromPATHand callsuvx --python ">=3.12". Checkuvx freecad-mcp --helpin a terminal. - The very first CLI request says the FreeCAD tools aren't available, the next one works. On first use,
uvxdownloadsfreecad-mcpand a Python ≥ 3.12, which can exceed the agent's MCP start-up timeout. Runuvx --python ">=3.12" freecad-mcp --helponce in a terminal to warm the cache. - Remote Ollama answers
403. Use the server's IP address instead of a host name (see Local models). - Remote Ollama times out although it's running. Windows may have created Block firewall rules for
ollama.exe(when its network prompt was dismissed). Prefertailscale serveas above, which needs no firewall rule. - FreeCAD started from a packaged app sees a different profile. Processes launched from MSIX-packaged apps (for example a terminal inside some desktop apps) may get a virtualized
%APPDATA%, so addons installed there don't show up in the FreeCAD you open from the Start menu. Install into the real%APPDATA%\FreeCAD\v1-1\Mod. - Logs: last CLI turn in
<FreeCAD user data>/chatcad_last.log; attachments in<FreeCAD user data>/chatcad_anexos/.
Credits
- freecad-mcp by neka-nat: the FreeCAD MCP server the CLI providers use.
- UI inspired by the agent sidebar of OpenChatCut.
License
LGPL-2.1, the same license as FreeCAD.
🇧🇷 Em português
Chat CAD é um painel de agente de IA dentro do FreeCAD. Você descreve a peça, clica numa face ou rabisca na vista 3D, e o agente modela para você, sempre de forma paramétrica (as medidas ficam na planilha Parametros; ajuste e aperte Ctrl+R).
Agentes: Claude Code, Codex e Antigravity (usam o login que você já tem) ou IA local pelo Ollama, no seu computador ou em outro PC seu com placa de vídeo (via Tailscale, veja Local models).
Para usar:
- Instale o FreeCAD 1.0+ e clone este repositório na pasta
Moddo FreeCAD; reinicie. O painel abre à esquerda (Ctrl+Shift+Espaçomostra e esconde). - IA na nuvem: instale o uv, o complemento do freecad-mcp (ligue Auto-Start Server) e faça login em
claude,codexouagy(o Antigravity precisa dos passos extras de Requirements). - IA local: instale o Ollama e um modelo com ferramentas (ex.:
ollama pull qwen3.5:9b). Na engrenagem do painel você escolhe servidor, modelo de visão, raciocínio e se o modelo sai da memória depois de cada resposta.
IA local ainda não rola para peças de verdade. Ela está integrada e funciona, mas nos nossos testes os modelos locais (qwen3:8b, qwen3.5:9b e qwen3.8:27b, no processador do notebook e na placa de vídeo do desktop) só acertaram peças simples. Todas as peças reais falharam, mesmo pedindo uma parte de cada vez. Para trabalho de verdade, use Codex, Claude Code ou Antigravity.
O que os testes mostraram (fotos de cada resultado em Tests): o Codex foi o mais rápido e fiel (suporte idêntico ao original em 6 min); o Claude Code também acertou a forma; o Antigravity pareceu certo, mas a conferência numérica achou a placa traseira com só 1 mm de espessura atrás do cesto. Placa de vídeo resolve a velocidade da IA local (10 a 16 vezes mais rápida), não o raciocínio.
Testado no Windows 11 com o FreeCAD 1.1.4. Versão alfa: relatos de bugs e contribuições são bem-vindos!
来源:GitHub · github.com




















