This week Hackaday ran a short piece on mesh2cad, my open source tool that turns an STL of a simple mechanical part into STEP or an editable CadQuery, OpenSCAD or FreeCAD script: https://hackaday.com/2026/11/19/mesh2cad-automates-re-modelling/
The repo went from 14 to around 80 stars in a day, which is more than the previous month. More useful than the stars was the first proper bug report from someone I don't know.
What the report found
The reporter converted a noisy test plate (80 x 50 x 6 mm, four holes) and opened the STEP with OCP instead of trusting the exit code. The solid was inside-out. Negative volume, written with exit 0. On another seed the solid was valid but about 6 mm away from the mesh.
The cause was in the fallback path. When a least squares snap moved a vertex too far, the code projected that vertex onto the first fitted surface instead, with no distance check. On a thin plate the first surface was sometimes the opposite wall, so the top face got pulled down by the plate thickness.
What changed in 0.32.0
The projection is now guarded too: if it moves the vertex more than the snap limit, the original vertex stays. Then, before anything is written, the writer checks the signed volume. A reversed solid gets flipped. A snapped hybrid whose volume misses the mesh by more than 5%, or that sits too far from the mesh, is dropped and the plain faceted solid is written instead. An inside-out solid is never written.
The report also said one of the Original Prusa i3 parts came back faceted on 0.31.0. I could not reproduce that: on 0.22.0 and 0.32.0 it is exact (210 planes, 4 cylinders), and the sewing code did not change in between. I added a slow test that locks the face counts of all six Prusa parts, and asked for the reporter's OCP version.
Limits, same as before
mesh2cad is for brackets, plates and similar parts made of planes, cylinders and cones. Organic shapes, figurines and scans with heavy noise still come out faceted or are refused. That is on purpose: I would rather it say no than write a wrong solid, and this bug was exactly the case where it did not say no.
pip install -U mesh2cad
mesh2cad convert part.stl part.step
Repo: https://github.com/emirmrkaljevic/mesh2cad
If you have an STL that converts badly, an issue with the file attached helps more than anything else.
Top comments (0)