Reading VTK files into Julia?

Hello!

Is there any Julia library which wraps the VTK library in such a way that both legacy and new vtk file formats can be read?

The top search item is “ReadVTK.jl”, which supposedly can read the new XML vtk file format, but not the legacy formats - I need to be able to do both.

Kind regards

You can use Python package meshio. I have a Julia wrapper FiniteMesh.jl built on top of it.

Great thanks!

And it is correctly understood that even though it is based on Python, I don’t need to install anything directly? Just “using FiniteMesh” and then it should be fine?

Kind regards

Unfortunately does not work for me:

Only VTK 'UNSTRUCTURED_GRID', 'STRUCTURED_POINTS', 'STRUCTURED_GRID', 'RECTILINEAR_GRID' supported (not POLYDATA).

Didn’t think that POLYDATA would be any different

Thanks for the suggestion once again

Kind regards

Okay, then I would suggest the official vtk library for Python vtk · PyPI.
Then you will need to use PyCall or PythonCall.jl.

Give a try to

Doesn’t work either, returns:

VTKFile("PartBound_0000.vtk")
ERROR: bad VTK file format (found legacy format; only VTK XML files are currently supported)

So properly due to it being a polydata legacy VTK file, not based on XML :confused:

Kind regards

Maybe you can load the file into Visit or Paraview and then ask to save again into the new format?

Yep, perhaps I can make a converter function which does it automatically for me in Paraview. Software I am using outputs legacy VTK format presumably because it was developed in ~2010 and a low priority to update :slight_smile:

Thanks for the help everyone

1 Like