magnet.generate.tetrahedra_from_stl#

magnet.generate.tetrahedra_from_stl(surface_path: str, min_size: float = 0, remesh: bool = False)#

Create a tetrahedral mesh from a STL file.

Generates tetrahedral elements starting from the surface triangulation in the STL using gmsh and then saves the new mesh.

Parameters:
  • surface_path (str) – STL file path.

  • min_size (float, optional) – Minumu size of the tetrahedral elements. Default is 0 (no lower bound).

  • remesh (bool, optional) – If True, remesh the STL before generating the mesh (default is False).

Return type:

None

Notes

Remeshing by gmsh works well when traingles have similar sizes and are not very elongated; usually, STL coming from CAD projects are not suitable for this.