# How to get selected block names from SelectSurfaceBlocks(python)

**URL:** https://discourse.paraview.org/t/how-to-get-selected-block-names-from-selectsurfaceblocks-python/9755
**Category:** ParaView Support
**Tags:** python
**Created:** [June 7, 2022, 3:16pm UTC](https://discourse.paraview.org/t/how-to-get-selected-block-names-from-selectsurfaceblocks-python/9755 "2022-06-07T15:16:43Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mclarsen](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@mclarsen](https://discourse.paraview.org/u/mclarsen)
#### Post date: [June 7, 2022, 3:16pm UTC](https://discourse.paraview.org/t/how-to-get-selected-block-names-from-selectsurfaceblocks-python/9755/1 "2022-06-07T15:16:43Z")

</div>

I am having difficulty getting the names of the selected blocks using this call. First, I select some subset of blocks, then I call Extract Selection. However, I can’t seem to get the block names out.

If I look at the hierarchy inside the extracted selection via the mutli-block inspector, all the original block names are present (i.e., both selected blocks and unselected ones). In the UI, the selected blocks are available:

![Screen Shot 2022-06-06 at 12.09.51 PM](https://discourse.paraview.org/uploads/default/original/2X/0/0d31101af753c9d11564b57d20e6e905f37707e1.png)

Any tips about how to get the selected block names in python would be appreciated.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 8, 2022, 6:44am UTC](https://discourse.paraview.org/t/how-to-get-selected-block-names-from-selectsurfaceblocks-python/9755/2 "2022-06-08T06:44:56Z")

</div>

Hi @mclarsen

`source.GetDataInformation().DataInformation.GetBlockName(idx)`

Best,

---

<div class="post-metadata">

### Author: ![mclarsen](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@mclarsen](https://discourse.paraview.org/u/mclarsen)
#### Post date: [June 8, 2022, 2:31pm UTC](https://discourse.paraview.org/t/how-to-get-selected-block-names-from-selectsurfaceblocks-python/9755/3 "2022-06-08T14:31:23Z")

</div>

I am still confused. I created a simple example where I create two point sources (offset from each other), Group them into a multi-block, the select one of the two blocks, and call extract selection. In the extract selection object, I can still call

```auto
extractSelection.GetDataInformation().DataInformation.GetBlockName(idx)

```

on each block index and it will happily return the name, even if its is not selected. What I need is only the names of the selected blocks.
