Skip to main content

meshlane

I/O for mesh files: convert smoothly between many formats.

License: MIT PyPI version Code style: black

meshlane is an actively maintained descendant of meshio by Nico Schlömer. It builds directly on meshio's codebase and history, and extends it with new format support and fixes geared toward FEA/CFD interoperability (code_aster, Ansys, OpenFOAM, Salome/MED). See Relationship to meshio.

There are many mesh formats for representing unstructured meshes. meshlane reads and writes all of the following and converts smoothly between them:

Abaqus (.inp), ANSYS msh (.msh), Ansys/APDL input (.inp, .cdb), AVS-UCD (.avs), CGNS (.cgns), DOLFIN XML (.xml), Exodus (.e, .exo), FLAC3D (.f3grid), H5M (.h5m), Kratos/MDPA (.mdpa), Medit (.mesh, .meshb), MED/Salome (.med), Nastran (bulk data, .bdf, .fem, .nas), Netgen (.vol, .vol.gz), Neuroglancer precomputed format, Gmsh (formats 2.2, 4.0, 4.1, .msh), OBJ (.obj), OFF (.off), OpenFOAM polyMesh (.foam, read only), PERMAS (.post, .post.gz, .dato, .dato.gz), PLY (.ply), STL (.stl), Tecplot .dat, TetGen .node/.ele, SVG (2D output only) (.svg), SU2 (.su2), UGRID (.ugrid), VTK (.vtk), VTU (.vtu), WKT (TIN) (.wkt), XDMF (.xdmf, .xmf).

What meshlane adds over meshio

  • OpenFOAM polyMesh reader: ASCII and binary, arbitrary cell types (tri / quad / polyhedra).
  • Ansys/APDL .inp / .cdb reader & writer for FEA interoperability.
  • MED/Salome improvements:
    • multi-mesh files (several meshes in one .med)
    • polygon cell support, including ragged/Voronoi meshes
    • multi-timestep result fields, with NDT/NOR/PDT preserved
    • round-trip of mesh metadata, field units and component names
    • MED 4.1 bitmask metadata and HDF5 link-creation-order, so files stay readable by Salome / medfile / mdump
    • extended field data types (float32/64, int32/64)
    • robust handling of missing FAS / NOEUD / GRO sections and merged cell blocks
  • Encoding and parsing robustness fixes (Latin-1 metadata, group name parsing).

Installation

meshlane is available on PyPI:

pip install meshlane[all]

([all] pulls in the optional dependencies netCDF4 and h5py, required for the CGNS, H5M, MED and XDMF formats. By default only numpy is needed.)

To install from source instead:

git clone https://github.com/simvia-tech/meshlane.git
cd meshlane
pip install -e .[all]

Usage

Command line:

meshlane convert    input.msh output.vtk   # convert between two formats
meshlane info       input.xdmf             # show some info about the mesh
meshlane compress   input.vtu              # compress the mesh file
meshlane decompress input.vtu              # decompress the mesh file
meshlane binary     input.msh              # convert to binary format
meshlane ascii      input.msh              # convert to ASCII format

In Python, read a mesh:

import meshlane

mesh = meshlane.read(
    filename,                # path, os.PathLike, or a buffer/open file
    # file_format="stl",     # optional; inferred from the extension
)
# mesh.points, mesh.cells, mesh.cells_dict, ...

Write a mesh:

import meshlane

points = [
    [0.0, 0.0], [1.0, 0.0], [0.0, 1.0],
    [1.0, 1.0], [2.0, 0.0], [2.0, 1.0],
]
cells = [
    ("triangle", [[0, 1, 2], [1, 3, 2]]),
    ("quad", [[1, 4, 5, 3]]),
]

mesh = meshlane.Mesh(
    points,
    cells,
    point_data={"T": [0.3, -1.2, 0.5, 0.7, 0.0, -3.0]},
    cell_data={"a": [[0.1, 0.2], [0.4]]},
)
mesh.write("foo.vtk")

# Or, equivalently:
meshlane.write_points_cells("foo.vtk", points, cells)

For both reading and writing you may pass file_format= explicitly (e.g. to force ASCII over binary VTK).

Time series

The XDMF format supports time series sharing one mesh:

with meshlane.xdmf.TimeSeriesWriter(filename) as writer:
    writer.write_points_cells(points, cells)
    for t in [0.0, 0.1, 0.21]:
        writer.write_data(t, point_data={"phi": data})
with meshlane.xdmf.TimeSeriesReader(filename) as reader:
    points, cells = reader.read_points_cells()
    for k in range(reader.num_steps):
        t, point_data, cell_data = reader.read_data(k)

Testing

tox

(Some test meshes are stored with Git LFS; run git lfs pull after cloning.)

Relationship to meshio

meshlane is a fork of meshio. We kept the full git history and authorship so the original work remains properly attributed. We started a separate project, rather than only contributing upstream, to move faster on the FEA/CFD interoperability features we need (code_aster, Ansys, code_saturne, OpenFOAM, Salome, etc.) and to maintain them under active development.

meshio is no longer actively maintained. Simvia is a company willing to commit time and people to keep this project alive and moving forward.

Contributing

Everyone is welcome, individuals and companies alike. If you want to help us keep meshlane maintained, we would be glad to have you on board. We will do our best to triage issues quickly and to give timely, constructive feedback on pull requests.

Huge thanks to Nico Schlömer and all meshio contributors for the foundation this project is built on.

License

meshlane is published under the MIT license, the same as meshio. Copyright is retained by the original meshio authors and the meshlane contributors.

Metadata

Release files for meshlane 5.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meshlane 5.5.0
File Size Uploaded
meshlane-5.5.0.tar.gz 226.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for meshlane 5.5.0
File Interpreter ABI Platform
meshlane-5.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 434.9 kB

Release files / meshlane-5.5.0.tar.gz

Download URL meshlane-5.5.0.tar.gz
Size 226.7 kB
Tags Source
SHA-256 checksum
How to use checksums
261f1eaa3ade9f553bb31eabfa2a652f32e7e1dddbb69111ae8751bd0bf688ba
BLAKE2b-256 checksum
How to use checksums
4f7f9bc74db198ede07aecccfa5e3f6bd0a10b0a8fbda5e02d6c2974095b2737
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Release files / meshlane-5.5.0-py3-none-any.whl

Download URL meshlane-5.5.0-py3-none-any.whl
Size 208.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4e11d33e1313cb2ad1997f11bcb9457feaab242b4607aa8d7bdddbabcf5855a
BLAKE2b-256 checksum
How to use checksums
5d8255693f23c9f3da98fc1c40da3e956f41e542145475afa19db726e73ae49c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

5.5.0 This release

2 release files

5.4.3

2 release files

5.4.2

2 release files

5.4.1

2 release files

5.4.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page