[vtkusers] vtkOBJReader

Chris Scharver scharver at evl.uic.edu
Wed Mar 10 08:56:17 EST 2004


On Mar 10, 2004, at 7:28 AM, Bernhard Mayrhofer wrote:

> If i use a eg. vtkPolyData *test, i can aquire the correct number ob 
> points.
> But with following code, this does not work.
>
> vtkOBJReader *View = vtkOBJReader::New();
> View->SetFileName("f:/models/test.obj");
> nPoints=View->GetOutput()->GetNumberOfPoints();

VTK sets up a pipeline of execution. In your code here, the pipeline 
has not yet executed, so the vtkOBJReader doesn't contain any data. Try 
the following:

vtkOBJReader *View = vtkOBJReader::New();
View->SetFileName("f:/modes/test.obj");
View->Update; // force the VTK pipeline to update
nPoints = View->GetOutput()->GetNumberOfPoints();

The Update() call makes sure that the VTK pipeline has been executed, 
and that in turn ensures that your obj file has been read from disk.

Hope this helps,
Chris

--
Chris Scharver
Electronic Visualization Laboratory
The University of Illinois at Chicago
Ph: 312-996-3002   FAX: 312-413-7585
<http://www.evl.uic.edu/scharver/>




More information about the vtkusers mailing list