Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception while writing VTK file #17

Open
MichaelHillier opened this issue Jun 30, 2020 · 2 comments
Open

Exception while writing VTK file #17

MichaelHillier opened this issue Jun 30, 2020 · 2 comments

Comments

@MichaelHillier
Copy link

Hello there,

I've created a tetrahedral mesh using the tetgen API successfully and able to visualize using pyvista. However, when I try to write a VTK file i get the exception "'UnstructuredGrid' object has no attribute 'write'". I've tried both the legacy format *.vtk and xml format *.vtu. Below is my code:

tgen = tetgen.TetGen(v, f)
nodes, elems = tgen.tetrahedralize(quality=True, minratio=1.414, mindihedral=16, varvolume=1, nobound=1, vtkview=1)
tgen.write('data/test.vtk')

TetGen's method write() called above uses a grid object (an UnstructuredGrid):

self.grid.write(filename, binary)

but it doesn't have a method called write().

Am I doing something wrong when I generate the mesh (via. tetrahedralize())?

Thanks

Mike

@akaszynski
Copy link
Member

Looks like I should be using save instead of write. If you're feeling up to it you can submit a PR for this. Otherwise, I can but it might take a few days as I'm a bit swamped.

@MichaelHillier
Copy link
Author

I can confirm that using self.grid.save(filename, binary) works. No worries that you can't get to it right away with the fix, I understand - am also swamped!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants