vtkStringArray derives directly from vtkAbstractArray and not vtkDataArray so you need to use:<br> <i>print input.GetPointData().GetAbstractArray("hop")</i><br><br>Andy<br><br><div class="gmail_quote">On Mon, Aug 12, 2013 at 10:37 AM, Yves Rogez <span dir="ltr"><<a href="mailto:yves.rogez@obs.ujf-grenoble.fr" target="_blank">yves.rogez@obs.ujf-grenoble.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
Hi,<br>
<br>
I'm trying to pass string arrays stored in vtkPolyData sets through
the pipeline, using Python programmable filters.<br>
Below is a sample code :<br>
<br>
In a ProgrammableSource1 :<br>
<blockquote><i>output=self.GetOutput()</i>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i><br>
</i></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i>points=vtk.vtkPoints()</i></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i>points.SetNumberOfPoints(1)</i></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i>points.SetPoint(0,0,0,0)</i></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i><br>
</i></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i>stra=vtk.vtkStringArray()</i></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i>stra.SetName("hop")</i></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i>stra.Allocate(1)</i></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i>stra.InsertNextValue("hop")</i></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i><br>
</i></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i>output.SetPoints(points)</i></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i>output.GetPointData().AddArray(stra)</i></p>
</blockquote>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">In a directly connected
ProgrammableFilter1 :</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i><br>
</i><i> input=self.GetInput()</i></p>
<i>
</i>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i>
output=self.GetOutput()</i></p>
<i>
</i>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i><br>
</i></p>
<i>
</i>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i>
output.SetPoints(input.GetPoints())</i></p>
<i>
</i>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i>
output.GetPointData().CopyStructure(input.GetPointData())</i></p>
<i>
</i>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i><br>
</i></p>
<i>
</i>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><i>
print input.GetPointData().GetArray("hop")</i></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><br>
</p>
The result of the 'print' call at the end is "None", but should not
be in my understanding. If we do the exact same thing with a
vtkDoubleArray, it works.<br>
<br>
Any idea on this issue ?<br>
<br>
Thanks,<br>
<br>
Yves<br>
<br>
</div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br></blockquote></div><br>