[vtkusers] Why I can't create a global vtkPolyData instance?

Wenlong Wang scc.wwl at gmail.com
Tue May 1 08:09:53 EDT 2012


Hi, David

Here is a short demo code. It is built in an empty console application in
Windows 7 with Visual Studio 2008(C++)

//----------------------------------------------------
#include <vtkPolyData.h>
#include <vtkPoints.h>
#include <vtkCellArray.h>
#include <vtkGenericDataObjectReader.h>

vtkPolyData* polydata = vtkPolyData::New();                // error pops
vtkPoints* points = vtkPoints::New();                           // no error
vtkCellArray* polygon = vtkCellArray::New();                // no error
vtkGenericDataObjectReader* reader = vtkGenericDataObjectReader::New();

void main()
{
    reader->SetFileName("C:\\Users\\Wenlong\\Desktop\\surface.vtk");
    reader->OpenVTKFile();
    reader->Update();

    polydata = reader->GetPolyDataOutput();
    points = polydata->GetPoints();
    polygon = polydata->GetPolys();
}

Many thanks.

Wenlng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120501/05aa432b/attachment.htm>


More information about the vtkusers mailing list