I asked an acquaintance who works in CAD professionally what is still missing from working with CAD through an AI agent. The first item on their list was:
Automatic stitching of STL into BREP solids.
I decided to start there. A mesh-to-solid converter already sounds solved, so the interesting part is what "stitched" actually gives you.
A valid solid, and still faceted
An STL file is a triangle mesh. Stitch it into a closed BREP solid and you get something valid, but a round hole can remain a ring of narrow flat faces. Here is the same part, tiltservomount_std.stl (2884 triangles), stitched without surface recognition:
808 faces, every one of them a plane. The solid is valid, but the holes and the lug are made of narrow flat strips, not cylindrical surfaces.
I wanted the tool to recognize planes and cylindrical regions in the mesh and replace them with real analytic BREP surfaces. The result for the same file:
31 faces: 21 Plane and 10 Cylinder. The surface types are read from the BREP itself; the orange color is applied for the figure only. The tool is convert_mesh_to_brep in my open-source fork of FreeCAD MCP, so an AI agent driving FreeCAD can call it.
What was checked, and what was not
I ran six STL files from Pan and Tilt for Standard Servo by micromet (CC BY-SA) through a single tool, with repair=true and default tolerances, without selecting faces or dimensions by hand.
- All six results are closed, valid solids, and they survived a save-and-reopen test.
- The volume change on every part is under 0.04%.
- A residual-faceting scanner found no remaining chains of faces it knows how to recognize.
That is a weaker claim than it sounds, and I want to be specific about why:
- All six parts come from one set, and the tool was developed against them.
- Close volumes do not prove accurate surfaces. I did not measure the maximum distance between the source mesh and the result.
- A closed solid does not mean the cylinders were recovered. That is why the report keeps BREP validity and residual faceting (
reconstruction_status) as separate fields. - NURBS surfaces, cones and spheres are not reconstructed, and the tool does not recover the part's modeling history.
Where I need your help
I am not a CAD professional, and six parts is clearly not enough. I would like to find STL files that break this tool: cylinders left faceted, wrongly recognized surfaces, distorted holes, extra geometry, or a mesh it cannot process at all.
If you try it, a problem STL, a screenshot of expected vs. actual, your FreeCAD version and the JSON report help the most. For commercial or confidential models, an anonymized or deliberately simplified example that reproduces the defect is enough. Bugs and ideas go to GitHub Issues.
The full write-up is on my site: the multi-pass pipeline (up to four recognition passes), the per-part results table, a working call example and the report fields: https://hram.github.io/en/articles/freecad-mcp-mesh-to-brep/


Top comments (0)