Hello everyone. I have a polydata with scalars ( 0,1 or 2 ) in the cells.<div>I want to extract all the cells with scalar 1.</div><div>Finally, when I try to print the number of points in the extracted polydata, it gives me 0 . What I am missing here?</div>

<div>Should I construct the points set explicitly? </div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

polydata-&gt;GetPolys()-&gt;InitTraversal();<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">int i = 0; </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

 </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">while ( polydata-&gt;GetPolys()-&gt;GetNextCell ( npts, pts ) != 0 )<br>

{<br><span class="Apple-tab-span" style="white-space:pre">        </span>if (cellScalarsPolydata-&gt;GetValue( i ) == 1) // if cell scalar == 1, get it.<br><span class="Apple-tab-span" style="white-space:pre">        </span>{<br><span class="Apple-tab-span" style="white-space:pre">                </span>extractedCellArray-&gt;InsertNextCell(3);<br>

<span class="Apple-tab-span" style="white-space:pre">                </span>extractedCellArray-&gt;InsertCellPoint(pts[0]);<br><span class="Apple-tab-span" style="white-space:pre">                </span>extractedCellArray-&gt;InsertCellPoint(pts[1]);<br>

<span class="Apple-tab-span" style="white-space:pre">                </span>extractedCellArray-&gt;InsertCellPoint(pts[2]);<br><span class="Apple-tab-span" style="white-space:pre">        </span>}<br><span class="Apple-tab-span" style="white-space:pre">        </span>i++;<br>

}<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

vtkPolyData* extractedPolyData = vtkPolyData::New();<br>extractedPolyData-&gt;SetPolys(extractedCellArray);<br>extractedPolyData-&gt;BuildCells();<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

 </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">std::cout &lt;&lt; &quot;num points&quot; &lt;&lt; extractedPolyData-&gt;GetNumberOfPoints() &lt;&lt; std::endl; <font color="#ff0000">// This gives me 0</font></blockquote>

</div><div><br clear="all"><div><br></div>-- <br>--------<br>Gonzalo Amadio<br><br>
</div>