<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Dear all,<div class=""><br class=""></div><div class="">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.</div><div class="">For example, I want to visualize the evolution of the temperature along the path of my particle.</div><div class="">I have a data file with point coordinates (each line represents its evolution in time) and some scalars (like temperature, diameter) as input.</div><div class="">"x", "y", "z", "scalar1", "scalar2"</div><div class="">0, 0, 0, 300, 12.5</div><div class="">0, 12, 7, 302, 35.4</div><div class="">...</div><div class=""><br class=""></div><div class="">What I had already done is to convert my data into Table Of Points. Then, I used this Programmable Filter to connect the points :</div><div class=""><br class=""></div><div class=""><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);">pdi = self.GetPolyDataInput()</i></div><div class=""><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);">pdo = self.GetPolyDataOutput()</i></div><div class=""><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);">numPoints = pdi.GetNumberOfPoints()</i></div><div class=""><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);">pdo.Allocate()</i></div><div class=""><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);">for i in range(0, numPoints-1):</i></div><div class=""><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);"> points = [i, i+1]</i></div><div class=""><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);"> # VTK_LINE is 3</i></div><div class=""><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);"> pdo.InsertNextCell(3, 2, points)</i></div><div class=""><div class=""><br class=""></div><div class=""><br class=""></div></div><div class="">I have found, on the Paraview Wiki, a way to give a unique color for the line that link all the coordinates :</div><div class=""><br class=""></div><div class=""><pre class="de1" style="padding: 0px; border: 0px none white; line-height: 1.2em; font-size: 1em; margin-top: 0px; margin-bottom: 0px; background-image: none; vertical-align: top;"><div class="" style="font-family: Helvetica; white-space: normal;"><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);">pdi = self.GetPolyDataInput()</i></div><div class="" style="font-family: Helvetica; white-space: normal;"><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);">pdo = self.GetPolyDataOutput()</i></div><div class="" style="font-family: Helvetica; white-space: normal;"><div class=""><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);">numPoints = pdi.GetNumberOfPoints()</i></div><div class=""><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);">pdo.Allocate()</i></div><div class=""><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);"><br class=""></i></div></div><font face="Helvetica" class=""><i class="">colors <span class="sy0">=</span> vtk.<span class="me1">vtkUnsignedCharArray</span><span class="br0">(</span><span class="br0">)</span>
colors.<span class="me1">SetNumberOfComponents</span><span class="br0">(</span><span class="nu0">3</span><span class="br0">)</span>
colors.<span class="me1">SetName</span><span class="br0">(</span><span class="st0">"Colors"</span><span class="br0">)</span>
</i></font></pre><pre class="de1" style="padding: 0px; border: 0px none white; line-height: 1.2em; font-size: 1em; margin-top: 0px; margin-bottom: 0px; background-image: none; vertical-align: top;"><div class="" style="font-family: Helvetica; white-space: normal;"><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);">for i in range(0, numPoints-1):</i></div><div class="" style="font-family: Helvetica; white-space: normal;"><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);"> points = [i, i+1]</i></div><div class="" style="font-family: Helvetica; white-space: normal;"><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);"> # VTK_LINE is 3</i></div><div class="" style="font-family: Helvetica; white-space: normal;"><i class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);"> pdo.InsertNextCell(3, 2, points)</i></div></pre><pre class="de1" style="padding: 0px; border: 0px none white; line-height: 1.2em; font-size: 1em; margin-top: 0px; margin-bottom: 0px; background-image: none; vertical-align: top;"><font face="Helvetica" class=""><i class=""> </i></font><i class="" style="font-family: Helvetica; font-size: 1em;">colors.<span class="me1">InsertNextTuple3</span><span class="br0">(</span><span class="nu0">255</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="br0">)</span></i></pre><pre class="de1" style="padding: 0px; border: 0px none white; line-height: 1.2em; font-size: 1em; margin-top: 0px; margin-bottom: 0px; background-image: none; vertical-align: top;"><font face="Helvetica" class=""><i class="">
pdo.<span class="me1">GetPointData</span><span class="br0">(</span><span class="br0">)</span>.<span class="me1">AddArray</span><span class="br0">(</span>colors<span class="br0">)</span>
<span class="kw1">del</span> colors</i></font></pre><div class=""><br class=""></div><div class=""><br class=""></div></div><div class="">Do you have any idea how I can do that (with a Programmable Filter or not) ?</div><div class=""><br class=""></div><div class="">Thank you in advance.</div></body></html>