Displaying only first tier of child blocks in ExtractBlock-like filter plugin

I am trying to create filter via the VTKPythonAlgorithmBase class, and I want this filter to essentially be like the existing ExtractBlock filter, but only display the first level of child blocks in the multiblock data set, not the children of those children.

For example, below I’m showing the GUI input for an ExtractBlock filter on my dataset. The filter I want to design would only show “Solid”, and wouldn’t show “1_part1”, “2_part2”, etc.


For me, the difficulty has arisen in how I should set up the @smproperty decorator for this. My first attempt is below, and is basically an exact copy of ExtractBlock.

         <IntVectorProperty clean_command="CleanNames"
             <CompositeTreeDomain name="tree">
                     <Property function="Input" name="Input"/>
     def AddName(self, user_inp):

If I only wanted to show the first tier of child blocks, can it be done with the same input, and just a different Domain type or modification to the Domain? Or would I have to find a way to trim the input and continue using CompositeTreeDomain?

Hi Cailen,

If I understood correctly, you always need to display only the names from the first level of hierarchy. In this case, it is possible to simplify the task. You can try to use vtkDataArraySelection object, where you load names (“Solid”, …). It is supported directly by decorator in Python plugin:

# Ability for users to choose blocks in GUI from multi-block dataset    
    def GetDataArraySelection(self):
        return self._get_array_selection()

, so you will be able to see it’s GUI similarly to this:


and user will be able to check some blocks.

More details about plugin’s code for implementing vtkDataArraySelection you can find here: Custom Threshold filter with dropdown selection - #5 by pavel

Hope, this approach is suitable for you.

Best Regards,

1 Like


This is excellent! Thank you so much for the response. I haven’t had a chance to mess around with it yet, but from my quick readthrough I think it accomplishes exactly what I want.

I only wish I could have had this when I posted the original topic. I had to move forward with a lesser solution, and it has already become a part of several users’ workflows. I will have to wait until I next have time to try and implement this without upsetting existing workflows.

Thank you again so much for the response!