[vtkusers] Why I can't create a global vtkPolyData instance?
alex Dowson
alexdowson at hotmail.com
Tue May 1 08:18:46 EDT 2012
Hi
Can you try this way ?
//----------------------------------------------------
#include <vtkPolyData.h>
#include <vtkPoints.h>
#include <vtkCellArray.h>
#include <vtkGenericDataObjectReader.h>
vtkPolyData* polydata;
vtkPoints* points;
vtkCellArray* polygon;
vtkGenericDataObjectReader* reader;
void main()
{
polydata = vtkPolyData::New();
points = vtkPoints::New();
polygon = vtkCellArray::New();
reader = vtkGenericDataObjectReader::New();
reader->SetFileName("C:\\Users\\Wenlong\\Desktop\\surface.vtk");
reader->OpenVTKFile();
reader->Update();
polydata = reader->GetPolyDataOutput();
points = polydata->GetPoints();
polygon = polydata->GetPolys();
}
From: Wenlong Wang
Sent: Tuesday, May 01, 2012 5:39 PM
To: David Doria
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] Why I can't create a global vtkPolyData instance?
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
--------------------------------------------------------------------------------
_______________________________________________
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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120501/e836c3f1/attachment.htm>
More information about the vtkusers
mailing list