Hi, Alex<br><br>Many thanks to your reply. It is working now.<br><br>Thank you very much.<br><br>Best wishes<br>Wenlong<br><br><div class="gmail_quote">2012/5/1 alex Dowson [via VTK] <span dir="ltr">&lt;<a href="/user/SendEmail.jtp?type=node&node=5677970&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

        

<div dir="ltr">
<div style="font-size:12pt;font-family:&#39;Calibri&#39;"><div class="im">
<div>Hi</div>
<div> </div>
<div>Can you try this way ?</div>
<div> </div>
<div> </div>
</div><div><div class="im">//----------------------------------------------------<br>#include 
&lt;vtkPolyData.h&gt;<br>#include &lt;vtkPoints.h&gt;<br>#include 
&lt;vtkCellArray.h&gt;<br>#include 
&lt;vtkGenericDataObjectReader.h&gt;<br><br></div>vtkPolyData* polydata;</div><div class="im">
<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><div class="im"><div>    
reader-&gt;SetFileName(&quot;C:\\Users\\Wenlong\\Desktop\\surface.vtk&quot;);<br>    
reader-&gt;OpenVTKFile();<br>    
reader-&gt;Update();<br><br>    polydata = 
reader-&gt;GetPolyDataOutput();<br>    points = 
polydata-&gt;GetPoints();<br>    polygon = 
polydata-&gt;GetPolys();<br>}<br></div>
<div> </div>
</div><div style="font-size:small;font-style:normal;text-decoration:none;font-family:&#39;Calibri&#39;;display:inline;font-weight:normal">
<div style="FONT:10pt tahoma">
<div> </div>
<div style="BACKGROUND:#f5f5f5">
<div><b>From:</b> <a href="http://user/SendEmail.jtp?type=node&amp;node=5677939&amp;i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a> </div><div class="im">
<div><b>Sent:</b> Tuesday, May 01, 2012 5:39 PM</div>
</div><div><b>To:</b> <a href="http://user/SendEmail.jtp?type=node&amp;node=5677939&amp;i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a> </div>
<div><b>Cc:</b> <a href="http://user/SendEmail.jtp?type=node&amp;node=5677939&amp;i=2" rel="nofollow" link="external" target="_blank">[hidden email]</a> </div><div class="im">
<div><b>Subject:</b> Re: [vtkusers] Why I can&#39;t create a global vtkPolyData 
instance?</div></div></div></div>
<div> </div></div>
<div style="font-size:small;font-style:normal;text-decoration:none;font-family:&#39;Calibri&#39;;display:inline;font-weight:normal"><div><div class="h5">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 
&lt;vtkPolyData.h&gt;<br>#include &lt;vtkPoints.h&gt;<br>#include 
&lt;vtkCellArray.h&gt;<br>#include 
&lt;vtkGenericDataObjectReader.h&gt;<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-&gt;SetFileName(&quot;C:\\Users\\Wenlong\\Desktop\\surface.vtk&quot;);<br>    
reader-&gt;OpenVTKFile();<br>    
reader-&gt;Update();<br><br>    polydata = 
reader-&gt;GetPolyDataOutput();<br>    points = 
polydata-&gt;GetPoints();<br>    polygon = 
polydata-&gt;GetPolys();<br>}<br><br>Many thanks.<br><br>Wenlng<br>
</div></div><p>
</p><hr><div class="im">
_______________________________________________<br>Powered by 
<a href="http://www.kitware.com" target="_blank" rel="nofollow" link="external">www.kitware.com</a><br><br>Visit other Kitware open-source projects at 
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank" rel="nofollow" link="external">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages 
on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank" rel="nofollow" link="external">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Follow 
this link to 
subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank" rel="nofollow" link="external">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></div><p></p></div></div></div><div class="im">
<br>_______________________________________________
<br>Powered by <a href="http://www.kitware.com" target="_blank" rel="nofollow" link="external">www.kitware.com</a>
<br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="nofollow" link="external" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="nofollow" link="external" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:
<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" rel="nofollow" link="external" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
        
        <br>
        <br>
        </div><hr color="#cccccc" noshade size="1">
        <div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif"><div class="im">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                </div><a href="http://vtk.1045678.n5.nabble.com/Why-I-can-t-create-a-global-vtkPolyData-instance-tp5675843p5677939.html" target="_blank" rel="nofollow" link="external">http://vtk.1045678.n5.nabble.com/Why-I-can-t-create-a-global-vtkPolyData-instance-tp5675843p5677939.html</a>
        </div>
        <div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                
                To unsubscribe from Why I can&#39;t create a global vtkPolyData instance?, <a href="" target="_blank" rel="nofollow" link="external">click here</a>.<br>

                <a href="http://vtk.1045678.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_blank" link="external">NAML</a>
        </div></blockquote></div><br>

        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Why-I-can-t-create-a-global-vtkPolyData-instance-tp5675843p5677970.html">Re: Why I can't create a global vtkPolyData instance?</a><br/>
Sent from the <a href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html">VTK - Users mailing list archive</a> at Nabble.com.<br/>