1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

3Dモデルのフォーマット変換(pyvista+meshio)

Posted at

PyVistaとmeshioを用いて3Dモデルを変換します

コード

model_transfar.py
import pyvista as pv
import meshio

in_filename = 'input.stl'
out_filename = 'output.vtk'
reader = pv.get_reader(in_filename)
mesh = reader.read()

pv.save_meshio(out_filename,mesh)

1 : pv.get_reader()でフォーマットに合わせた読み込み関数を呼び出し
2 : reader.read()でメッシュを読み込みmeshに格納
3 : pv.save_meshioでmeshioモジュールを介してフォーマットに合わせて書き込み

対応拡張子

入力側
'.obj''.stl''.vtk'など[2]

出力側
meshio対応のファイルフォーマット[4]

参考

[1]https://tutorial.pyvista.org/index.html
[2]https://tutorial.pyvista.org/tutorial/02_mesh/solutions/e_read-file.html
[3]https://docs.pyvista.org/api/readers/_autosummary/pyvista.objreader
[4]https://www.rccm.co.jp/icem/pukiwiki/index.php?meshio

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?