面向Google编程CHARLES ZHANG

AI DAILY / 2026-09-08

九步搭建本地3D建模管线:llama.cpp驱动FreeCAD

9 easy steps for llama.cpp, a local model, Freecad (and pi coding agent) to generate solid objects that sound mechanically good and can be also be 3D printed/milled

Agent 开发r/LocalLLaMA · 2026-09-07

全文中文翻译 · AI 生成,仅供学习交流

# 用 llama.cpp、本地模型、Freecad(搭配 pi 编程智能体)生成机械结构合理、可 3D 打印/铣削的实体对象,9 步搞定

Linux 上的快速配置。

## STEP 0
下载/装好 llama.cpp、Freecad,再挑一个顺手的 gguf 模型(最好带图像读取能力,我用的是 Unsloth 量化的 Qwen3.8-27B-UD-Q4_K_M 以及对应的 mmproj-F16)、uv,外加可选的 pi.dev。

## STEP 1

bash
$ cd /your/path/to/ # 即安装位置

## STEP 2

bash
$ git clone https://github.com/neka-nat/freecad-mcp.git

## STEP 3

bash
$ cp -r freecad-mcp/addon/FreeCADMCP ~/.local/share/FreeCAD/v1-1/Mod/

## STEP 4.1
如果用 pi 编程智能体当建模助手,把下面这段写进 `~/.pi/agent/mcp.json`

或者

## STEP 4.2
如果用 llama-server 当建模助手,把下面这段写进一个叫 `freecad_mcp.json` 的文件

json
{
"mcpServers": {
"freecad": {
"command": "uv",
"args": [
"--directory",
"/your/path/to/freecad-mcp",
"run",
"freecad-mcp"
]
}
}
}

## STEP 5.1(pi 作为建模智能体)

bash
$ pi update; pi install npm:pi-mcp-extension

启动 pi,然后在里面敲一行命令

/mcp:start freecad

或者

## STEP 5.2(llama-server 作为建模智能体)
照常启动 llama-server,再加一个选项 `--mcp-servers-config /your/path/to/freecad_mcp.json`

去 llama-server 的 WebUI 里看一眼 Settings > Tools > Server 下有没有 `freecad_*` 这类工具,需要的话把「每次询问」的开关关掉让它自动跑。同样在 Settings > Agentic > Agentic turns 里把那个数值调到 99 之类的大数。

## STEP 6
照常启动 llama-server。如果模型支持图像,再加一个加载视觉插件的选项

bash
--mmproj name_of_the_mmproj.gguf

这样本地模型就能读 Freecad 的截图,帮你核对几何操作有没有做对。

## STEP 7
打开 Freecad,切到「MCP Add-on」工作台(workbench),点一下「Start RPC Server」或者「Auto-Start Server」。

## STEP 7.1
在 Freecad 里新建一个文档。

## STEP 8
去 llama-server 的 WebUI 或者 pi 里,敲一段类似下面的提示

in freecad generate a cube with a 5 spokes star shaped hole going through it from top to bottom

或者拿原帖那张图当起点

In freecad create a new project called "double smooth gears". Into this project design 2 equal gears with 20 spokes each that could be put in close contact with those of the other gear to rotate and counter-rotate one gear against the other one. The spokes "hills" have to be rounded and so the corresponding spokes "valleys" should be analogously; sort of a sinusoidal curve on a circular path.

## STEP 9
玩得开心,未来已经开启。