<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">What are the chances? with in 1 minute
      of me thinking about asking this, you actually ask it.<br>
      <br>
      I dont have the solution myself yet, but I was just looking at (in
      C++)<br>
      <br>
      vtkCellArray *polys;<br>
      vtkSmartPointer&lt;vtkPolyDataReader&gt; pd =
      vtkSmartPointer&lt;vtkPolyDataReader&gt;::New();<br>
      <br>
      pd-&gt;SetFileName( "test.vtk" );<br>
      polys = pd-&gt;GetOutput()-&gt;GetPolys();<br>
      <br>
      so I guess for python it is..<br>
      <br>
      Data = Reader.GetOutput().GetPolys()&nbsp;&nbsp; ???? I dont know Python so
      well.<br>
      <br>
      If it works, or you find the solution please followup.<br>
      <br>
      Thanks<br>
      A.<br>
      <br>
      On 6/30/2012 1:18 AM, Forrest Sheng Bao wrote:<br>
    </div>
    <blockquote
cite="mid:CAEckw0=ygsP5Gw21o4YnfYQ8mHVAY4Oc9oN6V1aGgK71avKqSA@mail.gmail.com"
      type="cite">Hi,&nbsp;
      <div><br>
      </div>
      <div>I am struggling to access polygon faces in my VTK files using
        Python. Suppose I have the following segment in my&nbsp;</div>
      <div>file:</div>
      <div><br>
      </div>
      <div>
        <div>POLYGONS 275558 1102232</div>
        <div>3 0 1 2</div>
        <div>3 3 2 1</div>
        <div>3 0 45 46</div>
        <div>3 0 46 1</div>
        <div>3 0 2 50</div>
      </div>
      <div><br>
      </div>
      <div>I used the piece of code below to prepare:&nbsp;</div>
      <div><br>
      </div>
      <div>
        <div>&nbsp; &nbsp; import vtk</div>
        <div>&nbsp; &nbsp; Reader = vtk.vtkDataSetReader()</div>
        <div>&nbsp; &nbsp; Reader.SetFileName('my_test_file.vtk')</div>
        <div>&nbsp; &nbsp; Reader.ReadAllScalarsOn() &nbsp;# Activate the reading of
          all scalars</div>
        <div>&nbsp; &nbsp; Reader.Update()&nbsp;</div>
        <div>&nbsp; &nbsp; Data = Reader.GetOutput()</div>
      </div>
      <div>
        &nbsp; &nbsp; CellData = Data.GetCell(0)</div>
      <div>&nbsp; &nbsp;&nbsp;</div>
      <div><br>
      </div>
      <div>I assume CellData.GetPointId(x) is what I should use. But I
        got wrong point ID after x =3.&nbsp;</div>
      <div><br>
      </div>
      <div>Can someone help me on this?&nbsp;</div>
      <div><br clear="all">
        Cheers, <br>
        Forrest<br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>

Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>

Please keep messages on-topic and check the VTK FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>

Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
    </blockquote>
    <br>
    <br>
  </body>
</html>