I think my question is quite simple for Programmable filter users with Paraview, but I really have no idea how to do that.
I am trying to visualize the path of one particle with a line colored by a scalar. (For example, I want to visualize the evolution of the temperature along the path of my particle.) I have a data file with point coordinates (each line represents its evolution in time) and some scalars (like temperature, diameter) as input.
"x", "y", "z", "scalar1", "scalar2"
0, 0, 0, 300, 12.5
0, 12, 7, 302, 35.4
After converted that into Table Of Points, I used a Programmable Filter to connect the points (thanks to this subject : How to connect points in paraview?) :
pdi = self.GetPolyDataInput()
pdo = self.GetPolyDataOutput()
numPoints = pdi.GetNumberOfPoints()
pdo.Allocate()
for i in range(0, numPoints-1):
points = [i, i+1]
# VTK_LINE is 3
pdo.InsertNextCell(3, 2, points)
Now, I think I just have to add a command line to specify a color thanks to the scalar associated, but I don't know how to do that. Do you have any idea?
Thanks a lot.
In the Programmable Filter properties panel, turn on the checkbox for "Copy Arrays". That will pass the point data (i.e. the "scalar1" and "scalar2" fields) to the line output. You can then color the lines by these fields as you would any other field.