# The vtkCellPicker is always able to pick block that have been set to invisible

**URL:** https://discourse.vtk.org/t/the-vtkcellpicker-is-always-able-to-pick-block-that-have-been-set-to-invisible/15119
**Category:** Support
**Created:** [January 7, 2025, 3:18am UTC](https://discourse.vtk.org/t/the-vtkcellpicker-is-always-able-to-pick-block-that-have-been-set-to-invisible/15119 "2025-01-07T03:18:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![keke](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/c5a1d2/32.png) [@keke](https://discourse.vtk.org/u/keke)
#### Post date: [January 7, 2025, 3:18am UTC](https://discourse.vtk.org/t/the-vtkcellpicker-is-always-able-to-pick-block-that-have-been-set-to-invisible/15119/1 "2025-01-07T03:18:20Z")

</div>

I am using `vtkMultiBlockDataSet` with `vtkDataSetSurfaceFilter` and `vtkCompositePolyDataMapper` to build a rendering pipeline. I want to implement functionality to hide the block that is picked. To achieve this, I use `vtkCellPicker->GetFlatBlockIndex()` and `vtkCompositePolyDataMapper->SetBlockVisibility()`.

However, I found that the result is not ideal because, although I managed to hide the block, `vtkCellPicker` can still pick it. This prevents me from hiding the block behind the previously hidden one. Is there any method to solve this problem?  
Thanks in advance

---

<div class="post-metadata">

### Author: ![manik](https://discourse.vtk.org/user_avatar/discourse.vtk.org/manik/32/9300_2.png) [@manik](https://discourse.vtk.org/u/manik)
#### Post date: [January 7, 2025, 3:11pm UTC](https://discourse.vtk.org/t/the-vtkcellpicker-is-always-able-to-pick-block-that-have-been-set-to-invisible/15119/2 "2025-01-07T15:11:21Z")

</div>

Hi, in my software, when we need to disable picking on an actor, we call

> myVtkActor-\>PickableOff();

Maybe you can use this when hiding your block ?

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [January 10, 2025, 2:09pm UTC](https://discourse.vtk.org/t/the-vtkcellpicker-is-always-able-to-pick-block-that-have-been-set-to-invisible/15119/3 "2025-01-10T14:09:51Z")

</div>

> [@keke](#):
>
> Is there any method to solve this problem?

The vtkCellPicker has code to handle vtkCompositeDataSet, but it has no code for vtkCompositePolyDataMapper. Therefore the picker doesn’t know whether the blocks are visible or not.

For this to work, someone would need to add a block visibility check to vtkCellPicker.cxx.

---

<div class="post-metadata">

### Author: ![keke](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/c5a1d2/32.png) [@keke](https://discourse.vtk.org/u/keke)
#### Post date: [January 13, 2025, 1:47am UTC](https://discourse.vtk.org/t/the-vtkcellpicker-is-always-able-to-pick-block-that-have-been-set-to-invisible/15119/4 "2025-01-13T01:47:17Z")

</div>

Thank you very much for your reply! I have resolved the issue by inheriting from `vtkCellPicker` and overriding its `IntersectActorWithLine`. However, I found that when using a large number of blocks (around 8000, each block containing approximately 2500 cells) and trying to update their coordinates, the performance of `vtkCompositePolyDataMapper` is quite poor. Therefore, I plan to abandon this approach and try a different path. I would greatly appreciate it if anyone could offer a better solution.
