# Is it possible to implement rubber band picking from a vtkMultiBlockDataSet using vtkExtractGeometry and an ImplicitFunction?

**URL:** https://discourse.vtk.org/t/is-it-possible-to-implement-rubber-band-picking-from-a-vtkmultiblockdataset-using-vtkextractgeometry-and-an-implicitfunction/3467
**Category:** Support
**Created:** [June 4, 2020, 11:59pm UTC](https://discourse.vtk.org/t/is-it-possible-to-implement-rubber-band-picking-from-a-vtkmultiblockdataset-using-vtkextractgeometry-and-an-implicitfunction/3467 "2020-06-04T23:59:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![scotsman60](https://discourse.vtk.org/user_avatar/discourse.vtk.org/scotsman60/32/6000_2.png) [@scotsman60](https://discourse.vtk.org/u/scotsman60)
#### Post date: [June 4, 2020, 11:59pm UTC](https://discourse.vtk.org/t/is-it-possible-to-implement-rubber-band-picking-from-a-vtkmultiblockdataset-using-vtkextractgeometry-and-an-implicitfunction/3467/1 "2020-06-04T23:59:09Z")

</div>

Hello!!!

I’ve been experimenting with picking/selection in vtk and started with picking points and cells from a vtkUnstructuredGrid using the frustum from a vtkInteractorStyleRubberBandPick style in a vtkExtractGeometry filter.

When I extend this code to use a vtkMultiBlockDataSet consisting of a hierarchy of vtkUnstructuredGrids as input, the vtkExtractGeometry filter fails to return any cells. The code fragment below works just fine when “target” is a vtkUnstructuredGrid - extract contains the cells inside the frustum. But when mesh is a vtkMultiBlockDataSet, extracted is “None”

```
        frustum = self.GetInteractor().GetPicker().GetFrustum()

        extract_geometry = vtk.vtkExtractGeometry()
        extract_geometry.SetImplicitFunction(frustum)
        extract_geometry.SetInputData(target)
        extract_geometry.Update()

        extracted = extract_geometry.GetOutput() 

```

Any guidance on how to rubber band pick from a vtkMultiBlockDataSet will be gratefully received.

Doug

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [June 5, 2020, 12:30am UTC](https://discourse.vtk.org/t/is-it-possible-to-implement-rubber-band-picking-from-a-vtkmultiblockdataset-using-vtkextractgeometry-and-an-implicitfunction/3467/2 "2020-06-05T00:30:29Z")

</div>

You can convert multiblock data set to simple polydata using vtkCompositeDataGeometryFilter. I’m not sure if the same works for unstructured grid, too, but if not then there should be a similar filter for that, too.

---

<div class="post-metadata">

### Author: ![scotsman60](https://discourse.vtk.org/user_avatar/discourse.vtk.org/scotsman60/32/6000_2.png) [@scotsman60](https://discourse.vtk.org/u/scotsman60)
#### Post date: [June 5, 2020, 1:07am UTC](https://discourse.vtk.org/t/is-it-possible-to-implement-rubber-band-picking-from-a-vtkmultiblockdataset-using-vtkextractgeometry-and-an-implicitfunction/3467/3 "2020-06-05T01:07:31Z")

</div>

Figured it out…

When using vtkExtractGeometry with a vtkMultiBlockDataSet, the output is not returned via GetOutput, but instead via GetOutputDataObject(0).

```
    frustum = self.GetInteractor().GetPicker().GetFrustum()

    extract_geometry = vtk.vtkExtractGeometry()
    extract_geometry.SetImplicitFunction(frustum)
    extract_geometry.SetInputData(target)
    extract_geometry.Update()

    extracted = extract_geometry.***GetOutputDataObject(0)***

```

All(?) of the non composite aware filters return their output this away - in a vtkMultiBlockDataSet. So all downstream operations have to be updated to access vtkMultiBlockDataSets as input.

Works pretty well when you know how!!!

Doug
