Aaron Zhang converts FreeCAD parts into validated build123d code with Claude
Aaron Zhang used MCP to convert a FreeCAD part containing 19 PartDesign features into build123d Python code and compared feature changes individually. Except for threads, feature-matching errors were within 0.15 mm³, and the volume difference for the complete part was 0.02%. Changing the pipe diameter still exposed fixed-dimension dependencies in the original design.
The article demonstrates a complete conversion process that reads the feature tree through MCP, generates build123d code, and performs geometric validation, focusing on how verification can support open-hardware reuse.

#build123d #FreeCAD #OpenHardware #CADasCode #MCP #OpenSource
I recently started devicecommons.com, a place to openly share test fixtures, bench instruments and component designs for others to reuse and build on. One question keeps coming up: what should the "source" of an open hardware design be? My answer is code. Here's why.

1. Freedom to choose your tool. Some people start from code, others from a 3D platform. Some have paid CAD, some use free tools like FreeCAD, some just need paper to sketch. I don't want to force anyone to change the tool they like. Design however you want; at release, it gets converted to code.
2. Design is thinking. Publishing should be explaining. A CAD file usually maps the designer's thinking: the detours, the workarounds, the order ideas came up. That's rarely the easiest version for others to understand. Converting to code at release restates the design so others can follow it.
3. Code is the ultimate parametric model. Any dimension can be a parameter, relationships are explicit, and a new variant is one command away.
4. Most CAD formats don't fit a digital workflow. They're binary or zipped, so git can't show a diff, review a pull request, or merge changes. Code can.
The open question was the conversion step. So I tried it on a real part.
The test
I connected Claude to FreeCAD over MCP and asked it to convert a frame tube from one of the project's fixtures into build123d, an open-source Python CAD library. The part has 19 PartDesign features: keyed slide slots, a through slot, a flange with indicator notches, a thread relief, a 3/4-24 UNS thread made with a helical sweep, a stepped bore, lock pins, an alignment V-groove, housing-stop ears, and two chamfers. Not a toy part.

How it worked

1. Read. One call over MCP dumped the whole feature tree: every sketch with its geometry and placement, pad and pocket depths and directions, revolve profiles, and the thread preset. Reading design intent directly beats reverse-engineering a STEP file.
2. Resolve. The chamfers were attached to "Edge101" and "Edge71", which are FreeCAD's internal edge numbers. They break as soon as the model changes. The AI asked FreeCAD where those edges actually are, then rewrote them as geometric rules with a count check, so the script fails loudly instead of quietly chamfering the wrong edge.

3. Write. It wrote the build123d script feature by feature, with a parameters dataclass, a minimum-wall check, and a CLI that exports STEP and STL.
4. Verify. For each feature, it compared what the feature adds or removes in FreeCAD and in build123d.

Every feature except the thread matched within 0.15 mm³. The whole part is within 0.02% by volume. The thread differs by design, since build123d generates it with a different thread library than FreeCAD's sweep.
That was about 15 minutes of AI work. My guess for doing it by hand is 3–5 hours, mostly reading sketches and chasing edge references.
What broke

- False alarm. FreeCAD's stored per-feature volumes made three correct features look wrong. Measuring the actual boolean differences settled it.
- FreeCAD stopped responding. A heavy whole-part check run inside FreeCAD was too much. Keep validation outside the CAD tool.
- Hidden dependencies. Making the tube longer worked. Changing the tube diameter failed, because some dimensions in the original are fixed numbers. AI can find these dependencies; a person still decides which dimensions should drive the part.
Takeaway
Connecting AI to the source CAD tool turns conversion into translation. Writing the code is the easy part. Verification is what makes it trustworthy, especially for equipment that may be used in medical device testing.
Others are converging on the same loop: write, run, check. build123d-mcp reports that the same model scored 0.360 without the feedback loop and 0.457 with it on CADGenBench, and text-to-cad packages similar skills for coding agents.
Next: package this as a reusable workflow and try it on a full fixture.
I'd love your input
- How would you make this workflow better?
- What should the "source" of open hardware be: native CAD files, STEP, or code?
- If you design in SolidWorks, Fusion or Onshape, would you use a converter like this? What would it need?
- build123d, CadQuery, OpenSCAD or something else, and why?
Tools: build123d (github.com/gumyr/build123d) · bd_warehouse · build123d-mcp · FreeCAD 1.1 · Claude
Source: Aaron Zhang · x.com