From STL to an editable FreeCAD macro: change one number, run it again
mesh2cad turns an STL into CAD. Every part gets a STEP file with real planes, cylinders and cones. When the part is simple enough it also gets a script with named parameters, so "make the hole 2 mm bigger" is one edited number instead of an afternoon of mesh surgery. Until now that script was CadQuery or OpenSCAD. A lot of people who print parts use FreeCAD, though, and asking them to install…
The mesh2cad tool now adds support for generating FreeCAD macros as an additional output format, alongside CadQuery and OpenSCAD scripts. This allows users to easily modify existing parts by simply editing one number in the macro and rerunning it. For example, changing the diameter of a hole from 10mm to 12mm updates the macro accordingly.
The macros are designed for parts that fit within a few supported shapes, such as boxes, extruded outlines, holes, chamfers, and fillets. The macro checks the generated part against the original STL, ensuring the deviation is within acceptable limits (maximum of 0.1mm or 4 times the tolerance, whichever is greater, and a 1% volume error).
If the part doesn't meet the criteria or the freecadcmd command-line tool isn't installed, the macro won't be generated. The tool also includes a new to_freecad utility for converting STL files to macros and checking the results.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.