Please help the newbie...

Pieper, Chris cpieper at
Thu Aug 26 15:50:20 EDT 1999

I'm trying to extract point coordinates from a vtkPolyData object which I
generate from a vtkPolyDataReader -- here's what I'm doing...

vtkPolyDataReader *reader = vtkPolyDataReader::New();

vtkPolyData *polydat = reader->GetOutput();
vtkPoints  *pointdat = (vtkPoints *) polydat->GetPoints();

cout << "# number of points = " << pointdat->GetNumberOfPoints() << "\n";


I know this may be a very round about way of getting at the points, but I'm
just trying to get something to work.  The program seems to choke on the
GetNumberOfPoints() method.  I've tried more direct approaches such as,

vtkPolyDataReader *reader = vtkPolyDataReader::New();

cout << "# number of points = " 
     << (reader->GetOutput())->GetNumberOfPoints() << "\n";

this runs, but I get a number of points = 0

I know I am reading the vtk file correctly because the rest of my
visualization pipeline works, generating the output I expect.  I'm just a
bit puzzled...

thanks in advance for any help you can offer.

Chris Pieper
cpieper at
v: 920-721-4037
f: 920-721-8471

This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.

More information about the vtkusers mailing list