<div dir="ltr"><div>Hi VTK experts,</div><div>I am not an expert vtk programmers like many others in the forum. I have a confusion.</div><div><br></div><div>I am creating a set of vtk points (and eventually a vtkpolydata) and want to create vtkcells for the associated points. I was looking at the examples and trying to implement this way ( <a href="http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/VisualizationAlgorithms/Cxx/TubesWithVaryingRadiusAndColors.cxx">http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/VisualizationAlgorithms/Cxx/TubesWithVaryingRadiusAndColors.cxx</a>)</div><div><br></div><div>What I am observing is that when I create vtkcells, I only create ONE cell. What is going wrong here and why not all vtkcells are created? </div><div><br></div><div>Any suggestions ?</div><div><br></div><div>Thanks in advance,</div><div>Chiranjib</div><div><br></div><div>Here is my code snippet</div><div><br></div><div><br></div><div><br></div><div><font face="monospace, monospace" color="#0000ff">// VTK points are defined here</font></div><div><font face="monospace, monospace" color="#0000ff">   </font></div><div><font face="monospace, monospace" color="#0000ff">    vtkSmartPointer<vtkPoints> newPoints = vtkSmartPointer<vtkPoints>::New();</font></div><div><font face="monospace, monospace" color="#0000ff">   </font></div><div><font face="monospace, monospace" color="#0000ff">// Set precision for the vtk points</font></div><div><font face="monospace, monospace" color="#0000ff">   newPoints->SetDataType( VTK_DOUBLE );</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff">    unsigned int count = 0;</font></div><div><font face="monospace, monospace" color="#0000ff">    double resolution = 0.1;</font></div><div><font face="monospace, monospace" color="#0000ff">      </font></div><div><font face="monospace, monospace" color="#0000ff">// Create the points for the entire volume</font></div><div><font face="monospace, monospace" color="#0000ff">      for (unsigned int j = 0; j<10; j++)</font></div><div><font face="monospace, monospace" color="#0000ff">      {</font></div><div><font face="monospace, monospace" color="#0000ff">         for (unsigned int i = 0; i<10; i++)</font></div><div><font face="monospace, monospace" color="#0000ff">         {</font></div><div><font face="monospace, monospace" color="#0000ff">            for (unsigned int k = 0; k<10; k++)</font></div><div><font face="monospace, monospace" color="#0000ff">            {</font></div><div><font face="monospace, monospace" color="#0000ff">               newPoints->InsertNextPoint( x0[0]+ resolution*i, x0[1]+ resolution*j, x0[2]+ resolution*k );</font></div><div><font face="monospace, monospace" color="#0000ff">               count++;</font></div><div><font face="monospace, monospace" color="#0000ff">            }      </font></div><div><font face="monospace, monospace" color="#0000ff">         }         </font></div><div><font face="monospace, monospace" color="#0000ff">      }    </font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff">std::cout << "length of mycube = " << xl << ","<<yl<<","<<zl << std::endl;</font></div><div><font face="monospace, monospace" color="#0000ff">std::cout << "Number of points = " << count << std::endl;</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff">   // Insert vtk cell arrays</font></div><div><font face="monospace, monospace" color="#0000ff">   vtkSmartPointer<vtkCellArray> cell = vtkSmartPointer<vtkCellArray>::New();</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff">   cell->InsertNextCell( count);</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff">   for (vtkIdType i= 0; i < count; i++)</font></div><div><font face="monospace, monospace" color="#0000ff">   {</font></div><div><font face="monospace, monospace" color="#0000ff"><span class="" style="white-space:pre"> </span>   cell->InsertCellPoint(i);</font></div><div><font face="monospace, monospace" color="#0000ff">   }</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff">// Define the polydata for the cube</font></div><div><font face="monospace, monospace" color="#0000ff">      vtkSmartPointer<vtkPolyData> np = vtkSmartPointer<vtkPolyData>::New();</font></div><div><font face="monospace, monospace" color="#0000ff">      np->SetPoints( newPoints );</font></div><div><font face="monospace, monospace" color="#0000ff">      np->SetLines( cell);</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff">   std::cout << "Number of cells "<< np->GetNumberOfCells() << ":" << count << std::endl;</font></div><div><br></div></div>