[vtkusers] Selecting/Extracting cells using points

David Doria daviddoria+vtk at gmail.com
Sun May 30 12:46:11 EDT 2010


> For anyone else interested, you use this by doing:
>
> selectionNode->GetProperties()->Set(vtkSelectionNode::CONTAINING_CELLS(), 1);
>
> David
>

Hm, so that seems to work when the selection is inverted, but not when
it is not inverted:

If I do this:

  vtkSmartPointer<vtkSelectionNode> selectionNode =
      vtkSmartPointer<vtkSelectionNode>::New();
  selectionNode->SetFieldType(vtkSelectionNode::POINT);
  selectionNode->SetContentType(vtkSelectionNode::INDICES);
  selectionNode->SetSelectionList(this->pointIds);
  selectionNode->GetProperties()->Set(vtkSelectionNode::INVERSE(), 1);
//invert the selection
  selectionNode->GetProperties()->Set(vtkSelectionNode::CONTAINING_CELLS(),
1); //keep cells that use remaining points

it works as expected, it removes the points that were in pointIds and
keeps the cells that are defined on the remaining points.

However, with out the inverse line:

  vtkSmartPointer<vtkSelectionNode> selectionNode =
      vtkSmartPointer<vtkSelectionNode>::New();
  selectionNode->SetFieldType(vtkSelectionNode::POINT);
  selectionNode->SetContentType(vtkSelectionNode::INDICES);
  selectionNode->SetSelectionList(this->pointIds);
  selectionNode->GetProperties()->Set(vtkSelectionNode::CONTAINING_CELLS(),
1); //keep cells that use remaining points

It seems to keep ALL of the points no matter how many are listed in
pointIds. If I remove the CONTAINING_CELLS line:

  vtkSmartPointer<vtkSelectionNode> selectionNode =
      vtkSmartPointer<vtkSelectionNode>::New();
  selectionNode->SetFieldType(vtkSelectionNode::POINT);
  selectionNode->SetContentType(vtkSelectionNode::INDICES);
  selectionNode->SetSelectionList(this->pointIds);

It keeps only the points listed in pointIds, but of course there are
no non-vertex cells in the output.

Can anyone explain this behavior?

Thanks,

David



More information about the vtkusers mailing list