Hi,
Polyhedral cells exported to a VTU file written with VTK 9.4 are not visible in ParaView (5.13.2). It works correctly with VTK files, and when using VTK 9.3 (both VTU and VTK). Below a MRE.
import vtk
from vtkmodules.vtkCommonCore import vtkIdList, vtkPoints
from vtkmodules.vtkCommonDataModel import VTK_POLYHEDRON, vtkUnstructuredGrid
from vtkmodules.vtkIOXML import vtkXMLUnstructuredGridWriter
points = vtkPoints()
points.InsertNextPoint(1.21412, 0, 1.58931)
points.InsertNextPoint(0.375185, 1.1547, 1.58931)
points.InsertNextPoint(-0.982247, 0.713644, 1.58931)
points.InsertNextPoint(-0.982247, -0.713644, 1.58931)
points.InsertNextPoint(0.375185, -1.1547, 1.58931)
points.InsertNextPoint(1.96449, 0, 0.375185)
points.InsertNextPoint(0.607062, 1.86835, 0.375185)
points.InsertNextPoint(-1.58931, 1.1547, 0.375185)
points.InsertNextPoint(-1.58931, -1.1547, 0.375185)
points.InsertNextPoint(0.607062, -1.86835, 0.375185)
points.InsertNextPoint(1.58931, 1.1547, -0.375185)
points.InsertNextPoint(-0.607062, 1.86835, -0.375185)
points.InsertNextPoint(-1.96449, 0, -0.375185)
points.InsertNextPoint(-0.607062, -1.86835, -0.375185)
points.InsertNextPoint(1.58931, -1.1547, -0.375185)
points.InsertNextPoint(0.982247, 0.713644, -1.58931)
points.InsertNextPoint(-0.375185, 1.1547, -1.58931)
points.InsertNextPoint(-1.21412, 0, -1.58931)
points.InsertNextPoint(-0.375185, -1.1547, -1.58931)
points.InsertNextPoint(0.982247, -0.713644, -1.58931)
dodechedronFace = [
[0, 1, 2, 3, 4],
[0, 5, 10, 6, 1],
[1, 6, 11, 7, 2],
[2, 7, 12, 8, 3],
[3, 8, 13, 9, 4],
[4, 9, 14, 5, 0],
[15, 10, 5, 14, 19],
[16, 11, 6, 10, 15],
[17, 12, 7, 11, 16],
[18, 13, 8, 12, 17],
[19, 14, 9, 13, 18],
[19, 18, 17, 16, 15]
]
dodechedronFacesIdList = vtkIdList()
dodechedronFacesIdList.InsertNextId(12)
for face in dodechedronFace:
dodechedronFacesIdList.InsertNextId(len(face))
for i in face:
dodechedronFacesIdList.InsertNextId(i)
uGrid = vtkUnstructuredGrid()
uGrid.InsertNextCell(VTK_POLYHEDRON, dodechedronFacesIdList)
uGrid.SetPoints(points)
writer = vtkXMLUnstructuredGridWriter()
writer.SetInputData(uGrid)
writer.SetFileName("polyhedron.vtu")
writer.SetDataModeToAscii()
writer.Update()
writer = vtk.vtkUnstructuredGridWriter()
writer.SetInputData(uGrid)
writer.SetFileName("polyhedron.vtk")
writer.Update()