<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>Hi</DIV>
<DIV> </DIV>
<DIV>Can you try this way ?</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>//----------------------------------------------------<BR>#include
<vtkPolyData.h><BR>#include <vtkPoints.h><BR>#include
<vtkCellArray.h><BR>#include
<vtkGenericDataObjectReader.h><BR><BR>vtkPolyData* polydata;</DIV>
<DIV>vtkPoints* points;</DIV>
<DIV>vtkCellArray* polygon;</DIV>
<DIV>vtkGenericDataObjectReader* reader;</DIV>
<DIV> </DIV>
<DIV><BR>void main()<BR>{<BR></DIV>
<DIV> polydata =
vtkPolyData::New();
<BR> points =
vtkPoints::New();
</DIV>
<DIV> polygon =
vtkCellArray::New();
</DIV>
<DIV> reader = vtkGenericDataObjectReader::New();<BR></DIV>
<DIV> </DIV>
<DIV>
reader->SetFileName("C:\\Users\\Wenlong\\Desktop\\surface.vtk");<BR>
reader->OpenVTKFile();<BR>
reader->Update();<BR><BR> polydata =
reader->GetPolyDataOutput();<BR> points =
polydata->GetPoints();<BR> polygon =
polydata->GetPolys();<BR>}<BR></DIV>
<DIV> </DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV style="FONT: 10pt tahoma">
<DIV> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=scc.wwl@gmail.com
href="mailto:scc.wwl@gmail.com">Wenlong Wang</A> </DIV>
<DIV><B>Sent:</B> Tuesday, May 01, 2012 5:39 PM</DIV>
<DIV><B>To:</B> <A title=daviddoria@gmail.com
href="mailto:daviddoria@gmail.com">David Doria</A> </DIV>
<DIV><B>Cc:</B> <A title=vtkusers@vtk.org
href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</A> </DIV>
<DIV><B>Subject:</B> Re: [vtkusers] Why I can't create a global vtkPolyData
instance?</DIV></DIV></DIV>
<DIV> </DIV></DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">Hi,
David<BR><BR>Here is a short demo code. It is built in an empty console
application in Windows 7 with Visual Studio
2008(C++)<BR><BR>//----------------------------------------------------<BR>#include
<vtkPolyData.h><BR>#include <vtkPoints.h><BR>#include
<vtkCellArray.h><BR>#include
<vtkGenericDataObjectReader.h><BR><BR>vtkPolyData* polydata =
vtkPolyData::New();
// error pops<BR>vtkPoints* points =
vtkPoints::New();
// no error<BR>vtkCellArray* polygon =
vtkCellArray::New();
// no error<BR>vtkGenericDataObjectReader* reader =
vtkGenericDataObjectReader::New();<BR><BR>void main()<BR>{<BR>
reader->SetFileName("C:\\Users\\Wenlong\\Desktop\\surface.vtk");<BR>
reader->OpenVTKFile();<BR>
reader->Update();<BR><BR> polydata =
reader->GetPolyDataOutput();<BR> points =
polydata->GetPoints();<BR> polygon =
polydata->GetPolys();<BR>}<BR><BR>Many thanks.<BR><BR>Wenlng<BR>
<P>
<HR>
_______________________________________________<BR>Powered by
www.kitware.com<BR><BR>Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html<BR><BR>Please keep messages
on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<BR><BR>Follow
this link to
subscribe/unsubscribe:<BR>http://www.vtk.org/mailman/listinfo/vtkusers<BR></DIV></DIV></DIV></BODY></HTML>