<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Courier New";
        panose-1:2 7 3 9 2 2 5 2 4 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Courier New\,courier";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Calibri;
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">Jan,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">I think you want to copy the field data as point data, not cell data. Since the points of your input are the same as your output, you can just call “PassData” to copy them over. Try this
 version of the script for the programmable filter:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-top:9.0pt"><span style="font-size:10.0pt;font-family:"Courier New\,courier"">pdi
<span style="color:#666666">=</span> <span style="color:green">self</span><span style="color:#666666">.</span>GetPolyDataInput()</span><span style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New\,courier"">pdo
<span style="color:#666666">=</span> <span style="color:green">self</span><span style="color:#666666">.</span>GetPolyDataOutput()</span><span style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New\,courier"">numPoints
<span style="color:#666666">=</span> pdi<span style="color:#666666">.</span>GetNumberOfPoints()</span><span style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New\,courier"">pdo<span style="color:#666666">.</span>Allocate()</span><span style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Courier New\,courier";color:green">for</span></b><span style="font-size:10.0pt;font-family:"Courier New\,courier""> i
<b><span style="color:#AA22FF">in</span></b> <span style="color:green">range</span>(<span style="color:#666666">0</span>, numPoints<span style="color:#666666">-1</span>):</span><span style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New\,courier""> points
<span style="color:#666666">=</span> [i, i<span style="color:#666666">+1</span>]</span><span style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New\,courier""> pdo<span style="color:#666666">.</span>InsertNextCell(<span style="color:#666666">3</span>,
<span style="color:#666666">2</span>, points)</span><span style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New\,courier""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New\,courier"">pdo<span style="color:#666666">.</span>GetPointData()<span style="color:#666666">.</span>PassData(pdi<span style="color:#666666">.</span>GetPointData())</span><span style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">-Ken<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-family:Calibri;color:black">From: </span>
</b><span style="font-family:Calibri;color:black">ParaView <paraview-bounces@paraview.org> on behalf of Jan Deca <jandeca@gmail.com><br>
<b>Date: </b>Saturday, May 7, 2016 at 6:17 PM<br>
<b>To: </b>"paraview@paraview.org" <ParaView@paraview.org><br>
<b>Subject: </b>[EXTERNAL] Re: [Paraview] Table of points to colored tube.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">So, I'm almost there with this script:<br>
<br>
"<br>
pdi = self.GetPolyDataInput()<br>
pdo =  self.GetPolyDataOutput()<br>
numPoints = pdi.GetNumberOfPoints()<br>
pdo.Allocate()<br>
for i in range(0, numPoints-1):<br>
 points = [i, i+1]<br>
 pdo.InsertNextCell(3, 2, points)<br>
<br>
ivals = pdi.GetPointData().GetScalars("u")<br>
ca = vtk.vtkFloatArray()<br>
ca.SetName(ivals.GetName())<br>
ca.SetNumberOfComponents(1)<br>
ca.SetNumberOfTuples(numPoints-1)<br>
pdo.GetCellData().AddArray(ca)<br>
for i in range(0, numPoints-1):<br>
  ca.SetValue(i, ivals.GetValue(i))<br>
"<br>
<br>
The only issue now is that the Tube filter is unhappy as it is unable to compute the normals making its output segmented looking like a collection of separate disks. I've attached a test-file and screenshot of the output.<br>
<br>
"<br>
<br>
<o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:13.0pt;font-family:Courier;color:black">Generic Warning: In /Users/kitware/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release-Python27/paraview/src/paraview/VTK/Common/DataModel/vtkPolyLine.cxx,
 line 106</span><o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:13.0pt;font-family:Courier;color:black">Coincident points in polyline...can't compute normals</span><o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt;-qt-paragraph-type:empty;-qt-block-indent:0">
<span style="font-size:13.0pt;font-family:Courier;color:black">Warning: In /Users/kitware/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release-Python27/paraview/src/paraview/VTK/Filters/Core/vtkTubeFilter.cxx, line 243</span><o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:13.0pt;font-family:Courier;color:black">vtkTubeFilter (0x7f840214ca40): Could not generate normals for line. Skipping to next.</span><o:p></o:p></p>
<p class="MsoNormal">"<br>
<br>
Anybody any suggestions?<br>
<br>
Thank you! <o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>