Ok, I've managed it (I write down the part of code in case someone reads this post and needs it). The weird thing is that I previously tried to write the PolyData to a text file. If I use the vtkPolyDataWriter before extracting the triangles, I get an empty array as if the vtkPolyDataWriter erased the PolyData. Is that normal? I think this is a begginer question but how do I know if a filter erases or changes the input contents? I've read each filter makes a copy of the input so I thought the input would stay as it is even if passed through a filter. Am I wrong? Many thanks to all your responses, Luca, burlen and Mike (also for the code).
<br> <br> int j=0;<br> int h;<br> int npts=3,*pts;<br> vtkCellArray* oCellArr= vtkCellArray::New();<br> oCellArr=oPolyDataDel->GetPolys();<br> for(int i=0;i<oPolyDataDel->GetNumberOfPolys();i++)
<br> {<br> h=oCellArr->GetNextCell(npts,pts);<br> <br> if(h==0){<br> break;<br> }<br> if(npts==3){<br> vTriangulos[j]= pts[0];<br> vTriangulos[j+1]= pts[1];
<br> vTriangulos[j+2]= pts[2];<br> j+=3;<br> }<br><br> }<br>