[vtkusers] vtkCellArray in python

David Gobbi david.gobbi at gmail.com
Wed Jan 19 15:04:19 EST 2011


On Wed, Jan 19, 2011 at 1:02 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> On Wed, Jan 19, 2011 at 12:54 PM, igorznt <igorznt at gmail.com> wrote:
>>
>> vtkCellArray in Python doesnt have the GetCell and GetNextCell method. How
>> could I work with its data without them?
>
> In python you can use the following signatures of these methods:
>
> int GetNextCell(vtkIdList *pts);
> void GetCell(vtkIdType loc, vtkIdList* pts);
>
> For example, in Python code,
>
> idList = vtk.vtkIdList()
>
> cellArray.GetNextCell(idList)
> for i in range(cellArray.GetNumberOfIds()):
>    id = cellArray.GetId(i)
>
> You can see all the wrapped methods by using Python "help", like this:
> help(vtk.vtkCellArray)

I had a typo in my example code.  It should have been:

cellArray.GetNextCell(idList)
for i in range(idList.GetNumberOfIds()):
    id = idList.GetId(i)

 - David



More information about the vtkusers mailing list