[vtkusers] access polygons in Python
Forrest Sheng Bao
forrest.bao at gmail.com
Fri Jun 29 18:18:35 EDT 2012
Hi,
I am struggling to access polygon faces in my VTK files using Python.
Suppose I have the following segment in my
file:
POLYGONS 275558 1102232
3 0 1 2
3 3 2 1
3 0 45 46
3 0 46 1
3 0 2 50
I used the piece of code below to prepare:
import vtk
Reader = vtk.vtkDataSetReader()
Reader.SetFileName('my_test_file.vtk')
Reader.ReadAllScalarsOn() # Activate the reading of all scalars
Reader.Update()
Data = Reader.GetOutput()
CellData = Data.GetCell(0)
I assume CellData.GetPointId(x) is what I should use. But I got wrong point
ID after x =3.
Can someone help me on this?
Cheers,
Forrest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120629/98d36efb/attachment.htm>
More information about the vtkusers
mailing list