# vtkCellPicker + vtkCompositePolyDataMapper2 + vtkMultiBlockDataSet = picking invisible blocks ...

**URL:** https://discourse.vtk.org/t/vtkcellpicker-vtkcompositepolydatamapper2-vtkmultiblockdataset-picking-invisible-blocks/7090
**Category:** Support
**Created:** [November 5, 2021, 8:13pm UTC](https://discourse.vtk.org/t/vtkcellpicker-vtkcompositepolydatamapper2-vtkmultiblockdataset-picking-invisible-blocks/7090 "2021-11-05T20:13:56Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Olivier](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/o/d2c977/32.png) [@Olivier](https://discourse.vtk.org/u/Olivier)
#### Post date: [November 5, 2021, 8:13pm UTC](https://discourse.vtk.org/t/vtkcellpicker-vtkcompositepolydatamapper2-vtkmultiblockdataset-picking-invisible-blocks/7090/1 "2021-11-05T20:13:56Z")

</div>

Hi,

I have a complex tree of PolyDatas nested inside a MultiBlockDataSet.  
MultiBlockDataSet is then showed with a vtkCompositePolyDataMapper2.

Individual PolyDatas can be shown or hidden by the mean of

```auto
Mapper->GetCompositeDataDisplayAttributes()->SetBlockVisibility(block, ...);

```

To pick those PolyDatas I’m using vtkCellPicker.  
Strange behavior : when a PolyData is hidden (and effectively not shown in the renderer), Cell picker continue to pick it.

I’ve quickly dug inside vtkCellPicker.cxx, and I do not see any place where the visibility check is done (code starting at line 417).

Is it a normal/known behavior ?  
How can I restrain picking to visible PolyDatas ?

Thanks !

---

<div class="post-metadata">

### Author: ![Olivier](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/o/d2c977/32.png) [@Olivier](https://discourse.vtk.org/u/Olivier)
#### Post date: [November 10, 2021, 3:11pm UTC](https://discourse.vtk.org/t/vtkcellpicker-vtkcompositepolydatamapper2-vtkmultiblockdataset-picking-invisible-blocks/7090/2 "2021-11-10T15:11:51Z")

</div>

Not much help on that one …

As far as I can tell, there is a missing test in `vtkCellPicker`, when scene data is driven by a `vtkCompositePolyDataMapper2`.

Standard `vtkPicker` checks `propCandidate->GetPickable()` when performing `Pick3DInternal` (vtkPicker.cs line 575).  
But `vtkCompositePolyDataMapper2` has a method `SetBlockPickability` that is not used at all during picking process.

According to me (pure nooby in VTK), `vtkCellPicker` should check the mapper type in `IntersectActorWithLine` (line 376), and if inheriting from `vtkCompositePolyDataMapper2`, should retrieve its `GetCompositeDataDisplayAttributes` and check value of `GetBlockPickability` on the current `vtkDataSet`.
