I was referring to issue #750 where it suggests to use this C++ code:
auto vertexes = vtkSmartPointer<vtkCellArray>::New();
for (int i = 0; i < data->GetNumberOfPoints(); i++) {
vtkIdType pid[1];
pid[0] = i;
vertexes->InsertNextCell(1, pid);
}
dataPoints->SetPoints(points);
dataPoints->SetVerts(vertexes);
However it is not clear to me how to translate in Python the “pid” lines.
I also found this on an older post, but it rises many errors.
num = model.GetNumberOfPoints()
ids = vtk.vtkIdList()
ids.SetNumberOfIds(num);
model.Allocate(1,1)
for i in range(0, num):
ids.SetId(i, i)
model.InsertNextCell(vtk.VTK_VERTEX, ids)
In the end, I understand that the error is with the “pid” index, that must be a vtkIdType
, but I cannot get it correct in Python.
Thanks!