When you download a rounded enclosure as an STL, every round corner is just hundreds of tiny triangles. If you want the corners a bit softer, or a hole 1 mm bigger, you usually redraw the whole part.

I have been working on mesh2cad, an open source tool that turns STL meshes of simple mechanical parts back into editable CAD. Over the last few releases (0.20.0 to 0.23.0) it learned to handle a box where every edge is rounded.

What changed

  • 0.20.0: a fully rounded box is rebuilt as an exact STEP solid: 6 planes, 12 cylinders and 8 sphere corners, instead of a triangle soup.
  • 0.21.0: the same box is written as a CadQuery, OpenSCAD or FreeCAD script with one parameter, edge_fillet_r.
  • 0.22.0: the box can also have a through hole (hole_1_d, position).
  • 0.23.0: the box can also have a round boss on top (boss_1_d, boss_1_h, position).

So the workflow is:

pip install mesh2cad mesh2cad convert box.stl --cadquery box.py mesh2cad params box.py mesh2cad edit box.py --set edge_fillet_r=4 --set hole_1_d=10 --in-place -o box.step 

It also runs as an MCP server (mesh2cad mcp), so an assistant can do the "make the hole 2 mm bigger" step for you.

How I check it

Every script is rebuilt and compared against the original mesh before it is written. The max deviation has to stay under max(4 x tolerance, 0.1 mm) and the volume error under 1%. I test on 3 random seeds with 0, 0.05 and 0.2 mm of added noise. If a fit misses the gate, the tool refuses and tells you why instead of handing you a wrong part.

Honest limits

  • It is for simple mechanical parts: boxes, plates, holes, bosses, extrusions, fillets. Organic shapes and sculpted models are out of scope.
  • At 0.2 mm noise the fitted rounding radius can drift a little (2.6 to 2.7 mm instead of 2.5 on the boss test).
  • A boss that cuts into the edge rounds, a free sphere and some other cases are still refused.
  • The FreeCAD macro is written but I could not measure its deviation in FreeCAD itself here. It is gated on the CadQuery check instead.

Code, examples and test numbers are on GitHub, and the package is on PyPI. If you have a simple printed part that it gets wrong, I would love an issue with the STL.