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>&nbsp; <br>&nbsp; int j=0;<br>&nbsp;&nbsp;&nbsp; int h;<br>&nbsp;&nbsp;&nbsp; int npts=3,*pts;<br>&nbsp;&nbsp;&nbsp; vtkCellArray* oCellArr= vtkCellArray::New();<br>&nbsp;&nbsp;&nbsp; oCellArr=oPolyDataDel-&gt;GetPolys();<br>&nbsp;&nbsp;&nbsp; &nbsp;for(int i=0;i&lt;oPolyDataDel-&gt;GetNumberOfPolys();i++)
<br>&nbsp;&nbsp;&nbsp; &nbsp;{<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; h=oCellArr-&gt;GetNextCell(npts,pts);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(h==0){<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(npts==3){<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vTriangulos[j]= pts[0];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vTriangulos[j+1]= pts[1];
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vTriangulos[j+2]= pts[2];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; j+=3;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; &nbsp;}<br>