[Paraview] vtkStringArray and CopyStructure

Andy Bauer andy.bauer at kitware.com
Mon Aug 12 11:35:33 EDT 2013


vtkStringArray derives directly from vtkAbstractArray and not vtkDataArray
so you need to use:
 *print input.GetPointData().GetAbstractArray("hop")*

Andy

On Mon, Aug 12, 2013 at 10:37 AM, Yves Rogez <yves.rogez at obs.ujf-grenoble.fr
> wrote:

>  Hi,
>
> I'm trying to pass string arrays stored in vtkPolyData sets through the
> pipeline, using Python programmable filters.
> Below is a sample code :
>
> In a ProgrammableSource1 :
>
> *output=self.GetOutput()*
>
> *
> *
>
> *points=vtk.vtkPoints()*
>
> *points.SetNumberOfPoints(1)*
>
> *points.SetPoint(0,0,0,0)*
>
> *
> *
>
> *stra=vtk.vtkStringArray()*
>
> *stra.SetName("hop")*
>
> *stra.Allocate(1)*
>
> *stra.InsertNextValue("hop")*
>
> *
> *
>
> *output.SetPoints(points)*
>
> *output.GetPointData().AddArray(stra)*
>
> In a directly connected ProgrammableFilter1 :
>
> *
> **        input=self.GetInput()*
> * *
>
> *        output=self.GetOutput()*
> * *
>
> *
> *
> * *
>
> *        output.SetPoints(input.GetPoints())*
> * *
>
> *        output.GetPointData().CopyStructure(input.GetPointData())*
> * *
>
> *
> *
> * *
>
> *        print input.GetPointData().GetArray("hop")*
>
>
>  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.
>
> Any idea on this issue ?
>
> Thanks,
>
> Yves
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130812/f9fd663f/attachment.htm>


More information about the ParaView mailing list