Hacker News new | ask | show | jobs
by kentlyons 46 days ago
Claude Code is now WAY better at the freecad python api. My product (related to ceramics) does a whole bunch of custom 3d modeling and the new generation of LLMs can go in and make significant changes and basically get it right. They can also deal with a lot of annoying corner cases when you run into them.
4 comments

I've also had really good success with FreeCAD, and the FreeCAD MCP server. So far I've had it design and build a custom workbench (woodworking project w/ cut list, assembly and hardware instructions, tool and part check lists) as well as a omni-directional differential style robot wheel module for a 3D printing.

I will say the differential wheel module was on the edge of what it was able to do. I had to bump it up to Fable and if I didn't already have a clear model in my head of what I wanted I don't think it could have pulled it off.

How do you prompt it? It seems it would be difficult to describe a 3d geometry correctly just with text. Do you provide hand-made sketches?
All text, but none of these were a one-shot task. There were a few serious gotchas that you need to pay close attention to. It understands problems VERY well when it actually controls the viewport and takes screenshots of the part, unfortunately it REALLY resists that instead preferring to make up a bunch of equations to justify/validate it but these were almost never correct. It frequently got things like axis backwards so when it would test for a potential collision it would test in the wrong direction. Guidance specifically for the axes might help there, I suspect it's assuming different real-world axis (maybe more aligned with the game industry axis than modeling or CAD axis standards).

When I approached those two projects I took different approaches. The workbench I had clear measured physical requirements and desires but no specific design in mind (such as number or size of drawers). I had a long back and forth working out a purely textual project description via Fable chat, I originally wasn't even going to model it in CAD and just build from the textual description. I had just seen someone else post success with FreeCAD + MCP and there were some measurements that were suspect... So I had it model it. It did pretty good entirely on its own but a wood bench is composed of effectively a bunch of differently sized rectangles oriented and put together correctly so it feels like this was an "easy task" for it to complete.

The other side of the coin was that inverted differential omni-wheel. This one I knew mechanically exactly what needed to happen and I wanted to model to make a parametric, re-usable model that could be dropped in to a bunch of different designs. This one needs some complex gearing built which it actually mostly did pretty well. Where it kept failing here was weirdly in the motor placement (it was a stock placeholder mesh of the motor part), it had a sled mount with screw slots to allow a little adjustment of the meshing of the final gears. Over half of my time working with the model was simply trying to get it to point the motor model in the correct direction, fully seated in the sled, with the screw slots accessible and physically not colliding with anything. The next hardest part was composite/boolean joined parts, specifically a couple of gears that are a combination of crown and pinion gear, it couldn't seem to comprehend that adding the two physical objects together wouldn't remove excess material from around one of the sets of teeth.

Kind of a ramble, but let me know if there are any more specifics I can provide.

Which freecad MCP are you using?
This is the one I've been using: https://github.com/neka-nat/freecad-mcp
In my experience the MCP is not needed, it just runs headless FreeCAD using CLI. The MCP can be useful if you want to run FreeCAD on a VPS, and then use ChatGPT e.g. on your phone (optionally via voice). But for local I'd go with the CLI. But they'll do just fine with the MCP, which probably wraps the Python API anyway (ideally, otherwise it could lack some features).
OpenSCAD as well. I bounce back and forth between the two of them a fair bit depending on what I'm doing and which one's going to be more ergonomic for the problem at hand. The Fusion 360 built-in chat thing... not so good in my very limited experience.
Seconding openscad (havent tried freecad to be fair) with opus 5.5

I had it design a model sailboat hull, and it fucking nailed it. It even designed it for printability. I’m genuinely really impressed.

I can imagine. I did a bit of poking with blender and the api use got better there as well. For my use case I needed BREPs so stuck with freecad. I'm tempted one of these days where I have a pile of extra tokens to see about converting it to directly use the Open Cascade library since I just need to model and not the UI.
Second this. Since Opus 4.6 there's been a very noticeable bump in accuracy at just doing FreeCAD+Python or OpenSCAD code, usually one-shots things with basically described geometry.

Recently, Sonnet 5.5 got quite good, too, but not at the level of Opus/Fable for complex geometry

Disclaimer: I use it for very precise 3D printing, not woodwork.

I'm now printing my 3rd or 4th totally Claude-generated 3d printed custom project enclosure. Opus 5.5 is quite good - it's been generating CadQuery scripts and exporting them as STL for me, along with image previews and so on.