![.obj または .stl ファイルを .mesh に変換するにはどうすればいいですか?](https://rvso.com/image/1070948/.obj%20%E3%81%BE%E3%81%9F%E3%81%AF%20.stl%20%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%92%20.mesh%20%E3%81%AB%E5%A4%89%E6%8F%9B%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%81%84%E3%81%84%E3%81%A7%E3%81%99%E3%81%8B%3F.png)
.obj
または.stl
ファイル (または別の CAD 形式) を に変換するにはどうすればいいです.mesh
か?
私が使ってみたもの:
- Qt3dスタジオ
- メッシュラボ
- メッシュミキサー
- ブレンダー
- コンパス3D
ただし、ファイルを.mesh
形式に変換できませんでした。
(base) comp@comp:~$ pip install meshio
Collecting meshio
Downloading meshio-5.0.0-py3-none-any.whl (163 kB)
|████████████████████████████████| 163 kB 200 kB/s
Requirement already satisfied: numpy in ./anaconda3/lib/python3.8/site-packages (from meshio) (1.18.5)
Installing collected packages: meshio
Successfully installed meshio-5.0.0
(base) comp@comp:~$ cd /home/comp/Qt/Examples/Qt-6.1.2/quick3d/view3d
(base) comp@comp:~/Qt/Examples/Qt-6.1.2/quick3d/view3d$ ls
CMakeLists.txt main_qml.o qml.qrc untitled.obj
doc Makefile qrc_qml_qmlcache.cpp view3d
main.cpp model.smesh qrc_qml_qmlcache.o view3d.pro
main.o qmlcache_loader.cpp teapot.mesh view3d.pro.user
main.qml qmlcache_loader.o untitled1.mtl
main_qml.cpp qml_qmlcache.qrc untitled1.obj
(base) comp@comp:~/Qt/Examples/Qt-6.1.2/quick3d/view3d$ meshio convert model1.obj output.mesh
Traceback (most recent call last):
File "/home/comp/anaconda3/bin/meshio", line 8, in <module>
sys.exit(main())
File "/home/comp/anaconda3/lib/python3.8/site-packages/meshio/_cli/_main.py", line 53, in main
return args.func(args)
File "/home/comp/anaconda3/lib/python3.8/site-packages/meshio/_cli/_convert.py", line 65, in convert
mesh = read(args.infile, file_format=args.input_format)
File "/home/comp/anaconda3/lib/python3.8/site-packages/meshio/_helpers.py", line 69, in read
return reader_map[file_format](filename)
File "/home/comp/anaconda3/lib/python3.8/site-packages/meshio/obj/_obj.py", line 19, in read
mesh = read_buffer(f)
File "/home/comp/anaconda3/lib/python3.8/site-packages/meshio/obj/_obj.py", line 93, in read_buffer
return Mesh(points, cells, point_data=point_data)
File "/home/comp/anaconda3/lib/python3.8/site-packages/meshio/_mesh.py", line 61, in __init__
raise ValueError(
ValueError: len(points) = 308908, but len(point_data["obj:vn"]) = 284573
(base) comp@comp:~/Qt/Examples/Qt-6.1.2/quick3d/view3d$
答え1
meshio
希望通りのことができるようです (自分では試していません)。以下を実行してインストールできます。
pip install meshio
または
pip install 'meshio[all]'
([all]
オプションの依存関係をすべて取り込みます。デフォルトでは、meshio
numpy のみを使用します。)
インストールが完了したら、次のコマンドを実行して.obj
ファイルを に変換できます.mesh
。
meshio convert input.obj output.mesh