<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<vtkPolyDataReader> pd =
vtkSmartPointer<vtkPolyDataReader>::New();<br>
<br>
pd->SetFileName( "test.vtk" );<br>
polys = pd->GetOutput()->GetPolys();<br>
<br>
so I guess for python it is..<br>
<br>
Data = Reader.GetOutput().GetPolys() ???? 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,
<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 </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: </div>
<div><br>
</div>
<div>
<div> import vtk</div>
<div> Reader = vtk.vtkDataSetReader()</div>
<div> Reader.SetFileName('my_test_file.vtk')</div>
<div> Reader.ReadAllScalarsOn() # Activate the reading of
all scalars</div>
<div> Reader.Update() </div>
<div> Data = Reader.GetOutput()</div>
</div>
<div>
CellData = Data.GetCell(0)</div>
<div> </div>
<div><br>
</div>
<div>I assume CellData.GetPointId(x) is what I should use. But I
got wrong point ID after x =3. </div>
<div><br>
</div>
<div>Can someone help me on this? </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>