tataratat / tetgenpy

python tetgen wrapper
https://tataratat.github.io/tetgenpy
GNU Affero General Public License v3.0
3 stars 0 forks source link

Save tetgenpy output to file? #5

Open Florian-Konrad opened 1 year ago

Florian-Konrad commented 1 year ago

Hi :) I generated a tetrahedral mesh like this

tetgenout = tetgenpy.tetrahedralize("", plc.to_tetgenio())

now i'm wondering what a good way is to save the mesh in tetgenout to file? Cheers Florian

j042 commented 1 year ago

Hi Florian,

if you are familiar with / your pipline uses tetgen native formats, you could use TetgenIO.save_*() functions. You can load those using TetgenIO.load_*() functions

Otherwise I can imagine a simple numpy based io:

np.save("tetgen_io.npz", points=tetgenout.points() , ...)

Best, Jae

j042 commented 5 months ago

Thankfully, vedo started to natively support TetgenIO objects - see #9. For example:

import vedo
...
tet = vedo.TetMesh(tetgenout)
tet.write("out.vtk")
Florian-Konrad commented 5 months ago

Hi Jae, thanks for the info! Vedo looks awesome! I had solved it with building a meshio object from the tetgenout myself and exporting to exodus format. But cool that vedo can probably do this now, too!