<div dir="ltr"><div>I read my point and cell datasets as numpy arrays:</div><div><br></div><div><div><span class="" style="white-space:pre">        </span>points = numpy.array(file1["/Points"])</div><div><span class="" style="white-space:pre">   </span>cells = numpy.array(file1["/Cells"]) #, dtype=numpy.int32)</div>
<div><span class="" style="white-space:pre">    </span>cellTypes = numpy.array(file1["/CellTypes"])</div></div><div><br></div><div>Without any problems I can set the points:</div><div><br></div><div><div><span class="" style="white-space:pre">   </span>grid = vtk.vtkUnstructuredGrid()</div>
<div><span class="" style="white-space:pre">    </span>vpoints = vtk.vtkPoints()</div><div><span class="" style="white-space:pre">  </span>vpoints.SetData(numpy_support.numpy_to_vtk(points))</div><div><span class="" style="white-space:pre">        </span>grid.SetPoints(vpoints)</div>
</div><div><br></div><div>but not cells:</div><div><br></div><div><div><span class="" style="white-space:pre">      </span>grid.GetCells().SetCells(NC, numpy_support.numpy_to_vtk(cells))</div></div><div><br></div><div><br></div>
<div>I get the error:</div><div><br></div>TypeError: SetCells argument 2: method requires a vtkIdTypeArray, a vtkLongArray was provided<br><div><br></div><div>I tried to cast/convert it, but had no luck. Is there a way to do it? Please help.</div>
<div><br></div><div>Regards,</div><div>Dominik</div></div>