File Input/Output#

Mesh files#

Reading and writing meshes from various file types is supported through the use of the meshio package which can read and write to a variety of common filetypes, including .vtu, .stl, .obj, and .inp. The mesh class provides read() and write() methods which utilize meshio to read and write from any meshio-supported format. Additionally, mesh objects can be converted to/from meshio’s mesh class using mymesh2meshio() and meshio2mymesh().

from mymesh import mesh
m = mesh.read('example.stl')
m.write('example.vtu')

Image files#

The image module has functions for reading/writing image files and generating image-based meshes. See Image-based Meshing for more details.