[vtkusers] extracting pointdata out of vtkXMLPolyDataReader

Brad King brad.king at kitware.com
Mon Aug 30 07:36:43 EDT 2004


Joeri Nicolaes wrote:

> I have written a vtk xml file (head.vtp see below) that consists of 2 
> points. I can read it in, but I can't extract the points out of the 
> PolyData object. What am I doing wrong?
>  
> # trying to read an vtk polydata xml file
> vtkXMLPolyDataReader reader
>  reader SetFileName "C:/Documents and Settings/staJN/My 
> Documents/XMLhead/head.vtp"
> # [reader GetOutput] is a polydata object!
> set poly [reader GetOutput]
> set points [$poly GetPoints]
> puts [$poly GetNumberOfPoints]
> OUTPUT: 0

You have to tell the reader to update its output before using it:

reader Update
puts [$poly GetNumberOfPoints]

-Brad




More information about the vtkusers mailing list