How to get selected block names from SelectSurfaceBlocks(python)

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

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

Hi @mclarsen

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

Best,

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

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.