[vtkusers] adding cells to existing Polydata

Tasnim hanene-jeder at hotmail.fr
Mon Sep 10 08:28:06 EDT 2012


Good morning,

is there anybody who can give a mehhod to add cells to an existing polydata.

I have a file with xyz point's coordinates and list of faces. I succeeded to
add these points to my existing polydata like this:

int nbp=polydata->GetNumberOfPoints();
int nbp1=nbp+1;
polydata->GetPoints()->InsertPoint(nbp1,x, y,z);
polydata->GetPoints()->Modified();
polydata->Modified();
polydata->Update();

when , then, i make: 
polydata->GetNumberOfPoints(); 
I find that my polydata's points number increased.
Now, i tried to add cells , in order to connect those points by:
vtkIdList* points = vtkIdList::New(); 

	   istringstream t(contenuface);  // one ligne of my file
	   string mot;    //contains one  pointId 
while ( std::getline( t, face, ' ' ) )    
  {    int z;
istringstream ( face )>>z;
 
int zz=z+nbpp;// update the Id of the new point
	   points->InsertNextId(zz); 
   } 
int cell=polydata->GetPolys()->GetNumberOfCells();
polydata->GetPolys()->InsertNextCell(points);
polydata->GetPolys()->Modified();
int cells=cell+1;
polydata->GetPolys()->UpdateCellCount(cells);

I didn't see new cells in my mesh. what's wrong in my  code.Any better
suggestion please
Thanks.

Tasnim



--
View this message in context: http://vtk.1045678.n5.nabble.com/adding-cells-to-existing-Polydata-tp5715971.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list