[vtkusers] Pick & delete cell

David Doria daviddoria at gmail.com
Wed Feb 27 14:02:50 EST 2013


On Wed, Feb 27, 2013 at 9:49 AM, Massinissa Bandou
<Massinissa.Bandou at usherbrooke.ca> wrote:
> Hi David,
> Sorry for late response, I tried the vtkExtractSelection by displaying the
> unselected cells:
>  selectionNode->GetProperties()->Set(vtkSelectionNode::INVERSE(),1);
>             extractSelection->Update();
>
> I hope this is what you mean directly from the polydata.
> But it seems not working because I still see the junctions/points or
> vertices and the cells if I "delete" a couple of neighboring cells.
> I don't know how you can delete the cells directly from the polydata??
>
>
> Thank you for your help!
>
> Massi

I meant try replacing

  vtkSmartPointer<vtkUnstructuredGrid> selected =
    vtkSmartPointer<vtkUnstructuredGrid>::New();
  selected->ShallowCopy(extractSelection->GetOutput());

with:

  vtkSmartPointer<vtkPolyData> selected =
    vtkSmartPointer<vtkPolyData>::New();
  selected->ShallowCopy(extractSelection->GetOutput());

I tried it, but the output

  std::cout << "There are " << selected->GetNumberOfCells()
            << " cells in the selection." << std::endl;

says that there are 0 cells in the selection when a vtkPolyData is
used, but 10 cells when a vtkUnstructuredGrid is used.

If anyone could explain why this is, that would be helpful. That is,
can we modify the example to use vtkPolyData, or is there a reason
that the cells cannot be copied into a vtkPolyData even though they
are 2D cells?

David



More information about the vtkusers mailing list