Extract Block filter for multi-block data set

Hello:
I have a multi-block data set, where I am using Extract Block filter to seperate some data . I created a python state file, python script looks like this :

# create a new 'Extract Block'
extractBlock1 = ExtractBlock(registrationName='ExtractBlock1', Input=post000041_400003e00h5)
extractBlock1.BlockIndices = [3]
extractBlock1.MaintainStructure = 1

# create a new 'Extract Block'
extractBlock2 = ExtractBlock(registrationName='ExtractBlock2', Input=post000041_400003e00h5)
extractBlock2.BlockIndices = [4]
extractBlock2.MaintainStructure = 1

When I run this script, In GUI, I have to manually choose the dataset again and apply. Is there any elegant way to apply the filter in python script ?

paraview_questions

extractBlock.UpdatePipeline()
extractBlock2.UpdatePipeline()

Thanks Mathieu.
Now I have update my python script. Now it looks like this :

create a new ‘Extract Block’

extractBlock1 = ExtractBlock(registrationName=‘ExtractBlock1’, Input=post000041_400003e00h5)
extractBlock1.BlockIndices = [3]
extractBlock1.MaintainStructure = 1
extractBlock1.UpdatePipeline()

create a new ‘Extract Block’

extractBlock2 = ExtractBlock(registrationName=‘ExtractBlock2’, Input=post000041_400003e00h5)
extractBlock2.BlockIndices = [4]
extractBlock2.MaintainStructure = 1
extractBlock2.UpdatePipeline()

Still I don’t see they are updating automatically . I have tested this in version 5.8.1 RC1 and 5.8.1 RC2.
Is this related to version ?

I suspect you want to

Show(extractBlock1)
Show(extractBlock2)

to mimic the effect of the “Apply” button.

Thanks Cory.
Show operation is bringing the eye icon. But my issue is when I run this script ( with UpdatePipeline and Show method) my block is not automatically selected and applied. As you can see in the image below. This was taken after I run the script, In the block indices, none is selected.

paraview_questions

I have also tried giving list names instead of numbers. No luck.

create a new ‘Extract Block’

extractBlock1 = ExtractBlock(registrationName=‘ExtractBlock1’, Input=post000041_400003e00h5)
extractBlock1.BlockIndices = [‘Surface’]
extractBlock1.MaintainStructure = 1
extractBlock1.UpdatePipeline()
Show(extractBlock1)

I think this is indeed a bug. Just calling extractBlock1.BlockIndices = [ <number> ] should have reflected correctly in the UI.

Mind reporting an issue on the issue tracker so we can track it down? Thanks.

1 Like

Thanks @utkarsh.ayachit. I have report an issue

Could you test with a recent nightly @kirit_101 ?

Thanks, @mwestphal. I have tested this on the recent nightly version (ParaView-5.9.0-862-g8ea174d9d4) and this works fine. I have also tested in Paraview 5.9.0 RC1, which works fine too.

Just to keep this documented for future readers. Python codes have changed from Version 5.9.0 RC1 to the recent nightly version.

For Paraview 5.9.0 RC1:

extractBlock1 = ExtractBlock(registrationName=‘ExtractBlock1’, Input=post000004_148100e03h5)
extractBlock1.BlockIndices = [3]

For recent nightly version:

extractBlock1 = ExtractBlock(registrationName=‘ExtractBlock1’, Input=post000004_148100e03h5)
extractBlock1.Selectors = [’/Root/Block0/Block1’]

FYI, the changes in master are a work-in-progress. As discussed here, I am currently making changes to setup the node names to match a sanitized version of the “label” provided, if any. So, in your case, to select Surface, for example, setting selectors to ['//Surface'] will do the trick.

Hi
Is it possible to select using selectors with parts of a string matching? For example there are multiple blocks containing surface.
Or retrive the name of the blocks?