[vtkusers] Help! PolyData and CellArray

Cory Quammen cquammen at cs.unc.edu
Thu Jul 27 14:03:11 EDT 2006


Ali,

Strangely enough, I had a similar problem with that method just today.
Here's how to fix it.

The GetCell() method in vtkCellArray is an internal method, which basically
means that you shouldn't try to use it (it takes a parameter that specifies
the offset into the cell array, rather than an index identifying the cell
you want, making its use unintuitive).

Instead, you can use the GetCell() method right in the vtkPolyData class.
Your code will look something like this (my VTK with Tcl is a little rusty,
so it is in C++ below):

vtkPolyData *polyData = obj->GetOutput();
cout << "Poly 1:" << polyData->GetCell(0) << endl;

I *think* the equivalent code in Tcl is:

set polyData [obj GetOutput]
puts "Poly 1: [polyData GetCell 0]

This should output the first cell in your OBJ file.

Hope this helps.

Cory

Hello,  I'm trying to get a list of all polygons for my imported obj file.
> Here is a little code fragment of how i'm trying to do it.
>
> vtkPolyData polyData
>     polyData SetPolys [[obj GetOutput] GetPolys]
>     puts "Poly1: [[polyData GetPolys] GetCell 0]"
>
> I'm getting an error saying that GetCell is not being given the correct
> parameters and i'll probably agree with it!  I think what i need to do is
> access each Cell in the cell array.
>
> Any help would be much appreciated.
>
> If you need any extra information please don't hesitate to ask.
>

-- 
Cory Quammen
University of North Carolina at Chapel Hill
http://www.cs.unc.edu/~cquammen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060727/86075e58/attachment.htm>


More information about the vtkusers mailing list