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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.






