meshio网格数据格式转换工具

联合创作 · 2023-09-28 09:39

meshio 是一个网格格式的输入/输出转换工具,既可以进行格式转换,也可以在 python 中调用相应函数。

支持以下格式的互转化:

用例

使用其中之一安装:

pip install meshio[all]

conda install -c conda-forge meshio

[all]拉入所有可选依赖项。默认情况下,meshio 仅使用 numpy。)

然后可以使用命令行工具

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

Python 中的用法:

import meshio

mesh = meshio.read(
    filename,  # string, os.PathLike, or a buffer/open file
    # file_format="stl",  # optional if filename is a path; inferred from extension
    # see meshio-convert -h for all possible formats
)
# mesh.points, mesh.cells, mesh.cells_dict, ...

 

 

 

浏览 30
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报