failed to read vtk data
zhang-qiang-github opened this issue · 2 comments
Describe the bug
I want to convert a vtkPolyData
into su2
file. So, firstly, I write this vtkPolyData
into vtk
file. Then, I want to use meshio.read
to read this file and write into su2
file. However, meshiio.read
failed.
To Reproduce
import vtkmodules.all as vtk
cone = vtk.vtkConeSource()
cone.Update()
writer = vtk.vtkPolyDataWriter()
writer.SetInputData(cone.GetOutput())
writer.SetFileName('test.vtk')
writer.Update()
writer.Write()
import meshio
mesh = meshio.read('test.vtk')
mesh.write('test.su2')
It report bug: Error: Couldn't read file test.vtk as vtk
.
Then, I look into the code, and I find that:
Only VTK 'UNSTRUCTURED_GRID, STRUCTURED_POINTS, STRUCTURED_GRID' supported (not polydata)
So, I convert my vtkpolydata
into unstructed_grid
by:
data = vtk.vtkUnstructuredGrid()
data.ShallowCopy(cone.GetOutput())
The final code is:
import vtkmodules.all as vtk
cone = vtk.vtkConeSource()
cone.Update()
data = vtk.vtkUnstructuredGrid()
data.ShallowCopy(cone.GetOutput())
writer = vtk.vtkUnstructuredGridWriter()
writer.SetInputData(data)
writer.SetFileName('test.vtk')
writer.Update()
writer.Write()
import meshio
mesh = meshio.read('test.vtk')
mesh.write('test.su2')
But it still reports Couldn't read file test.vtk as vtk
.
When I look into meshio
code, it report required section CELLS not found
.
Diagnose
The package version is:
win10
python 3.7
vtk 9.1.0
meshio 5.3.4
Any suggestion is appreciated~~~
Do you really have mesh without cells?
This should be fixed in the next release.