I am using Paraview with the Python Shell and I want to modify some coordinates. The considered data is opened using a reader, the new coordinates are saved just as txt. I obtain the grid from the reader by using the Fetch()-routine and then modify it -- but my question is: can I somehow "return" the now changed grid to the reader-object and then Show() it?
Here is the code used so far:
from paraview import simple
from paraview.vtk import *
import numpy as np
reader=simple.LSDynaReader(FileName='/home/test.d3plot')
reader.UpdatePipeline()
simple.Show(reader)
coord=np.loadtxt('/home/coord.dat')
pts=vtkPoints()
arr=vtkFloatArray()
arr.SetNumberOfComponents(3)
arr.SetVoidArray(coord,14766*3,1)
ug=vtkUnstructuredGrid()
#the data to be modified is a vtkUnstrucuredGrid in a vtkMultiBlockDataset
ug.ShallowCopy(simple.servermanager.Fetch(reader).GetBlock(84))
pts.SetData(arr)
ug.SetPoints(pts)
How can I make the changes visible now? Any help would be appreciated!
ParaView is not designed for this and hence doesn't provide mechanisms to do exactly that. If you want to transform data in Python, look at using the Programmable Filter (http://www.paraview.org/Wiki/Python_Programmable_Filter) instead.