Cam Encoder Designer FreeCAD MCP
Enables AI assistants to generate and inspect radial cams, barrel cams, and optical encoder discs in FreeCAD through MCP tools such as generate_cams and freecad_screenshot.
README
Cam & Encoder Designer
Design radial (disk) cams, barrel (cylindrical) cams, and optical encoder discs (incremental & absolute) — with live SVAJ analysis, design-rule checks, manufacturing exports (CSV/DXF), and one-click solid model generation in FreeCAD.
Python 3 + tkinter + matplotlib. No cloud, no license keys. MIT.

Highlights
- Motion program editor — compose the 360° cycle from Dwell / Rise / Return segments using 8 standard motion laws (cycloidal, simple harmonic, modified trapezoidal, modified sine, 3-4-5 & 4-5-6-7 polynomials, parabolic, uniform). Peak-acceleration coefficients validated against Rothbart's Cam Design Handbook. One-click example programs.
- SVAJ diagrams — displacement, velocity, acceleration and jerk vs cam angle, scaled to real units (mm/s…) by the cam speed.
- Radial cams — profile synthesis by inversion for translating roller (offset, CW/CCW) or flat-faced followers, with a live animation of the rotating cam driving its follower.
- Barrel cams — unwrapped groove development, groove-edge geometry, and a 3D preview.
- Encoder discs — incremental (PPR, duty, index/Z track, quadrature readout info) and absolute (1–12 bit Gray or binary code tracks).
- Design-rule checks — pressure angle vs the 30° guideline, undercutting (radius of curvature vs roller), flat-follower cusp condition, encoder window manufacturability. Every warning links to a fix in the built-in guide.
- Built-in user guide — press F1 (or any ❓ Help button): seven chapters explain every option, every motion law, and every warning. Hover any field for a tooltip.
- Exports — CSV motion tables, DXF R12 (cam profile, groove development, encoder mask for laser cutting), and FreeCAD solids via the bundled workbench.
Screenshots
| SVAJ diagrams | Barrel cam development |
|---|---|
![]() |
![]() |
| Encoder designer | Built-in user guide |
|---|---|
![]() |
![]() |
Generated solids in FreeCAD:
| Radial + barrel cams | Absolute encoder (8-bit Gray) | Incremental encoder |
|---|---|---|
![]() |
![]() |
![]() |
Installation
Requires Python 3.10+ (tkinter included in the standard Windows/macOS
installers; on Linux install python3-tk).
git clone https://github.com/Sweetkubuni/cam-encoder-designer.git
cd cam-encoder-designer
python -m venv .venv
.venv\Scripts\pip install -r requirements.txt
.venv\Scripts\python cam_designer.py
On Windows you can afterwards start it by double-clicking run.bat.
Using the designer
- Define the motion (left panel): add Rise / Dwell / Return segments — durations must total 360° and rises must cancel returns. Pick an entry from the Example drop-down to start from a known-good program. Double-click a segment to edit it; the editor describes each motion law.
- Check the SVAJ tab — smooth curves mean smooth running. Set the cam speed (rpm) to read peaks in real units.
- Enter the cam geometry — base circle, roller radius, offset and follower type for the radial cam; cylinder and roller radius for the barrel cam. The Results panel shows peak values; the status bar turns green (✓ OK) or red (⚠ warnings).
- Animate — on the Radial cam tab, drag the slider or press ▶ Play.
- Export — File menu for CSV/DXF, or Send to FreeCAD ⚙ for solids.
The Encoder tab is a self-contained designer: choose Incremental or Absolute, set the disc geometry, then export a DXF cutting mask or send the disc + shaft to FreeCAD.
Stuck? F1 opens the user guide; the Warnings explained chapter lists every warning with its remedy.
FreeCAD integration
The bundled workbench (freecad-workbench/CamDesigner, tested with
FreeCAD 1.0) turns designs into solids: an extruded radial cam with shaft
bore, a barrel cam with the roller-swept groove cut into the cylinder, and
encoder discs with windows cut through, assembled on a shaft.
- Run
install_workbench.bat(copies the workbench to%APPDATA%\FreeCAD\Mod), restart FreeCAD. - With FreeCAD running, click Send to FreeCAD in the designer — models
appear immediately. Without FreeCAD running, the design is saved as JSON
under
exports\and can be loaded later via the workbench command Import cam design…, which also exposes thickness, bore, outer radius and groove depth.
Automation / MCP
The workbench auto-starts a localhost XML-RPC bridge (127.0.0.1:9875).
freecad_mcp_server.py exposes it as MCP tools — freecad_ping,
generate_cams, freecad_exec, freecad_objects, freecad_screenshot —
so an AI assistant such as Claude Code can generate and inspect models.
Example MCP configuration:
{
"mcpServers": {
"freecad-cam": {
"type": "stdio",
"command": "<repo>/.venv/Scripts/python.exe",
"args": ["<repo>/freecad_mcp_server.py"]
}
}
}
Security note: the bridge executes Python sent from localhost. It binds 127.0.0.1 only; don't run it where other local users shouldn't have that access.
Exports reference
| Export | Where | Contents |
|---|---|---|
| Motion table (CSV) | File menu | θ, s, v, a, j (per rad) + profile coords + pressure angle |
| Radial profile (DXF) | File menu | closed profile + pitch curve (layers CAM_PROFILE, PITCH_CURVE) |
| Barrel development (DXF) | File menu | groove edges + centreline, unrolled flat |
| Disc mask (DXF) | Encoder tab / File menu | outline, bore, windows (OUTLINE, BORE, WINDOWS) |
| Solids | Send to FreeCAD | Part features in the active FreeCAD document |
Project layout
cam_designer.py the designer app (single file)
freecad_mcp_server.py MCP server bridging Claude <-> FreeCAD
freecad-workbench/CamDesigner/ FreeCAD workbench (builder, bridge, GUI commands)
install_workbench.bat copies the workbench into FreeCAD's Mod folder
docs/ README images + generate_images.py
requirements.txt, run.bat
Conventions
Millimetres and degrees throughout. Internally velocity/acceleration/jerk
are per radian of cam rotation (v = ds/dθ); plots and readouts also show
time-based values at the entered rpm. Encoder discs: dark = opaque,
white = transparent window; angles CCW from +x; the LSB track is outermost.
References
- mechref.org — Cam design
- METU OCW ME 301, ch. 8 (cam motion curves)
- Rothbart, Cam Design Handbook, McGraw-Hill 2004
- Quantum Devices — Incremental encoder basics
License
MIT — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。






