From an STL of an L-bracket to a CAD script where the fillet is one number
I keep building mesh2cad, a small open source tool that takes an STL mesh of a simple mechanical part and gives you back editable CAD: a CadQuery script, an OpenSCAD file, a FreeCAD macro and a STEP solid.
Version 0.24.0 adds one part I print a lot: the filleted L-bracket.
What you get
Give it an STL of an L-bracket with a rounded inner corner and rounded vertical edges, and the script it writes has named parameters:
-
fillet_rfor the corner radius -
base_x,base_y,base_tfor the base plate -
leg_x,leg_yfor the vertical leg
So changing the part is one command instead of mesh surgery:
pip install -U mesh2cad mesh2cad convert bracket.stl --cadquery -o bracket.py mesh2cad params bracket.py mesh2cad edit bracket.py --set fillet_r=3 --set base_t=5 --in-place -o bracket.step How it decides
mesh2cad only writes a script if the rebuilt solid matches the mesh. It compares the two and refuses when the deviation is above max(4 x tolerance, 0.1 mm) or the volume is off by more than 1%. A refusal writes no file at all, so you never get a script that quietly looks wrong.
Honest numbers
I test on synthetic brackets with three random seeds and added noise:
- no noise: passes 3 of 3
- 0.05 mm noise: passes 2 of 3
- 0.2 mm noise: refused
FreeCAD output is generated from the same checked model, but I did not run FreeCAD itself in these tests.
It is still a tool for simple prismatic parts: boxes, plates, brackets, holes, bosses, fillets. Organic shapes and scans with heavy noise are out of scope for now, and the README says so.
Try it
If you have a simple mechanical STL where it fails, an issue with the file (or a description of the shape) helps me most.