1

I am working with openmesh in Python (installed with pip) and in C++ (openmesh version 7.0). I must save a mesh under .vtk extension. Openmesh documentation says it is possible, but as far as I have tried, it does not work. Here is my piece of python code :

import openmesh as OM

mesh = OM.TriMesh()

#Add some vertices
vh0 = mesh.add_vertex([0,0,0])
vh1 = mesh.add_vertex([0,1,1])
vh2 = mesh.add_vertex([1,0,1])
vh3 = mesh.add_vertex([1,1,0])

#Add some faces (we are building a tetrahedron here)
mesh.add_face(vh0,vh1,vh2)
mesh.add_face(vh0,vh2,vh3)
mesh.add_face(vh0,vh3,vh1)
mesh.add_face(vh1,vh3,vh2)

OM.write_mesh('TEST_MESH.vtk',mesh)

It does not write TEST_MESH.vtk in my folder, or anywhere else. When I try with '.ply' or '.om', or any other extension supposedly supported according to openmesh documentation it works just fine. So, I don't get why it does not work, has anybody have any clue? Is '.vtk' extension not supported from openmesh writer after all?

EDIT :

Exploring further openmesh GitLab I found that the vtk writer was committed in C++ branch in 2014, but in a recent commit from python-binding branch, some (deleted) info implies vtk writer is not supported. I am a bit confused, did they give up vtk writter, with no changelog notification? (In that case, one should update their documentation)

Thanks for helping,

Charles.

CDuvert
  • 367
  • 1
  • 3
  • 14
  • 1
    The VTK writer was indeed disabled in OpenMesh. Alex submitted a patch and the writer is now enabled in the new openmesh-python version [1.1.1](https://pypi.org/project/openmesh/1.1.1/). Note that there's currently only a writer and no reader. – jsb Jul 06 '18 at 14:37
  • Thanks, it works just fine. This answers my question. – CDuvert Jul 12 '18 at 12:33

0 Answers0