Open Hardware & RISC-V

Mesh2Cad open-source Python tool converts STL meshes to parametric CAD formats

Key Takeaway

Mesh2Cad is a pip-installable Python utility that reverse-engineers STL meshes into editable parametric CAD files for FreeCAD, CadQuery, OpenSCAD, and STEP formats with built-in tolerance verification.

Summary

Developer Emir Mrkaljevic has released Mesh2Cad, an open-source Python tool that automates the conversion of polygon mesh files into parametric CAD representations. The software addresses a common workflow problem where downloadable STL files require structural modifications that are impractical to perform on raw mesh geometry. Rather than forcing users to rebuild models from scratch, Mesh2Cad generates native scripts and macros for multiple open-source CAD environments including FreeCAD (via Python macro), CadQuery, and OpenSCAD, plus standard STEP output.

The tool is distributed through PyPI as pip install mesh2cad and the complete source code is available on GitHub for audit and modification. A notable reliability feature is automatic self-verification: the scripts validate that the generated CAD geometry approximates the original mesh within specified tolerances before delivering output. However, the reconstruction approach is inherently limited to primitive-based geometry—boxes, brackets, holes, fillets, and chamfers—because it relies on constructive solid geometry techniques similar to OpenSCAD. Organic shapes, freeform curves, and complex sculptural meshes fall outside the tool's operational scope.

How Mesh2Cad reconstructs parametric geometry

  • Python-native distribution: The entire tool is implemented in Python and installable via pip install mesh2cad, with full source code hosted on GitHub for community audit and contribution.
  • Multi-format CAD output: Generates environment-specific deliverables including FreeCAD Python macros (not .FCSTD files directly), CadQuery scripts, OpenSCAD source code, and standard STEP files for broader interoperability.
  • Tolerance-based verification: Built-in self-checking mechanism ensures the reconstructed parametric model approximates the input mesh within acceptable deviation bounds before returning results.
  • CSG primitive constraints: Reconstruction is limited to constructive solid geometry primitives—extrusions, unions, differences, fillets, chamfers—and cannot handle organic surfaces, spline-driven forms, or free-flowing curves.
  • Open-source licensing and accessibility: Dual availability through PyPI package management and public GitHub repository lowers barriers for both end-users and developers seeking to extend or fork the functionality.

Why it matters

Mesh2Cad fills a persistent gap in the open-source hardware design toolchain between mesh-based 3D printing workflows and parametric engineering CAD, reducing manual rework for makers and mechanical designers who source STL files from repositories like Thingiverse or Printables. By targeting FreeCAD, CadQuery, and OpenSCAD specifically—rather than proprietary formats—it reinforces the viability of fully open-source CAD pipelines for small-batch manufacturing and hardware development, and its pip-based distribution aligns with standard Python scientific computing installation practices already familiar to many Linux users.

Original reference: hackaday.com →