I have two vtk files obtained after the simulation that needs to be merged for visualization. Initially, I had written the code with vtkPolyData, but since it is unstructured, I changed it to vtkAppendFiler. In both case, I am unable to see any visualization although the files contains the output contents.
Below is the code structure:
from vtk import vtkAppendFilter, vtkUnstructuredGridWriter, vtkPolyData, vtkUnstructuredGridReader
reader = vtkUnstructuredGridReader()
append = vtkAppendFilter()
filenames = ['file1.vtk', 'file2.vtk']
for file in filenames:
reader.SetFileName(file)
reader.Update()
polydata = vtkPolyData()
polydata.ShallowCopy(reader.GetOutput())
append.AddInputData(polydata)
append.Update()
writer = vtkUnstructuredGridWriter()
#writer = vtkPolyDataWriter()
writer.SetFileName('output.vtk')
writer.SetInputData(append.GetOutput())
writer.Write()