[vtkusers] indexing / accessing components of a vtkCellArray object

William Triffo wjtriffo at lbl.gov
Tue Jul 10 12:55:35 EDT 2007


thanks Meisam,

but I don't see the GetCell method in python when I look at the 
vtkCellArray object (dir function).

does anyone else have a comment; if this method is not implemented, is 
there a different way to view CellArray contents in python? I am just 
translating a connectivity array from a triangular mesh from another 
program into a vtkPolyData object, and want to verify that I am 
specifying the right connectivity in the CellArray; to do this, I need 
to be able to view the Cell contents in the array.

thanks,

-Jeff


Meisam Aliroteh wrote:
> I usually use the GetCell method (by the way I only worked with vtk 
> using C++). This only works if all of the cells have the same number 
> of points (i.e all cells are triangles, or quads, etc). The component 
> indices of a cell array is as follows:
>  
> The first number is number of points of the cell, the next numbers are 
> the point ids. So in case of the triangular cells we could have 
> something like this:
>  
> *3* 0 1 2 *3* 0 2 3 *3* 0 3 4 .....
>
> So now if you want to access the ith cell you can do the following: 
> GetCell( i*4, ......). Notice that we multiply by 4 (1 for the number 
> of cell points, 3 for the three point ids)
>
> On 7/9/07, *William Triffo* <wjtriffo at lbl.gov 
> <mailto:wjtriffo at lbl.gov>> wrote:
>
>     hello,
>
>     I apologize for a simple question, but how would I go about accessing
>     individual cells from a vtkCellArray object in python after I have
>     created one?
>
>     There doesn't appear to be a 'GetNextCell' method in python; is there
>     another way? I could not find this in the examples.
>
>     thanks,
>
>     -Jeff
>
>     _______________________________________________
>     This is the private VTK discussion list.
>     Please keep messages on-topic. Check the FAQ at:
>     http://www.vtk.org/Wiki/VTK_FAQ
>     Follow this link to subscribe/unsubscribe:
>     http://www.vtk.org/mailman/listinfo/vtkusers
>
>


-- 
-------------------------------------------------------------
Jeff Triffo
Auer Group, Donner Lab, Lawrence Berkeley National Laboratory
Raphael Group, Bioengineering Department, Rice University
Medical Scientist Training Program (MSTP), Baylor College of Medicine
phone (Berkeley): 510-486-7940
fax   (Berkeley): 510-486-6488   




More information about the vtkusers mailing list