[vtkusers] adding data to a vtkPolyData

Wayne Christopher wayne at 4raccoons.com
Thu Jul 14 00:23:16 EDT 2011


I have a vtkPolyData object that I am rendering with a vtkPolyDataMapper 
and a vtkActor.  I want to add some more points and cells to it, but I 
would rather not create a new vtkPolyData and copy both the old and new 
data.  I have tried this:

pdata->DeleteCells();
pdata->DeleteLinks();
vtkPoints* pts = pdata->GetPoints();
vtkCellArray* cells = pdata->GetPolys();
pts->InsertPoint ...
cells->InsertNextCell ...
cells->InsertCellPoint ...
pdata->BuildCells();
pdata->BuildLinks();
pdata->Update();
pdata->Modified();

but I don't see anything on the screen..  Should this work?  Are there 
any examples available of appending onto a vtkPolyData that's already in 
use?

Thanks,

     Wayne




More information about the vtkusers mailing list