[Paraview] Question about colorize a link-path between particles with a scalar

Lancelot Boulet lancelot.boulet at coria.fr
Mon Aug 22 09:36:58 EDT 2016


Hello everyone,

I found the solution. For people who are interesting, you have just to turn on the checkbox for « Copy Arrays » in the Programmable filter.

Sincerely.

> Le 16 août 2016 à 15:50, Lancelot Boulet <lancelot.boulet at coria.fr> a écrit :
> 
> Dear all,
> 
> I am trying to visualise the path of one particle with the line colored by a scalar. But I don’t really know how to do that.
> 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
> ...
> 
> What I had already done is to convert my data into Table Of Points. Then, I used this Programmable Filter to connect the points :
> 
> 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)
> 
> 
> I have found, on the Paraview Wiki, a way to give a unique color for the line that link all the coordinates :
> 
> pdi = self.GetPolyDataInput()
> pdo =  self.GetPolyDataOutput()
> numPoints = pdi.GetNumberOfPoints()
> pdo.Allocate()
> 
> colors = vtk.vtkUnsignedCharArray()
> colors.SetNumberOfComponents(3)
> colors.SetName("Colors")
>  
> for i in range(0, numPoints-1):
>     points = [i, i+1]
>     # VTK_LINE is 3
>     pdo.InsertNextCell(3, 2, points)
>     colors.InsertNextTuple3(255,0,0)
>  
> pdo.GetPointData().AddArray(colors)
> del colors
> 
> 
> Do you have any idea how I can do that (with a Programmable Filter or not) ?
> 
> Thank you in advance.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160822/866bbf19/attachment.html>


More information about the ParaView mailing list