# Design question about vtkExtractBlock UsingDataAssembly

**URL:** https://discourse.vtk.org/t/design-question-about-vtkextractblock-usingdataassembly/7399
**Category:** Support
**Created:** [December 14, 2021, 8:48am UTC](https://discourse.vtk.org/t/design-question-about-vtkextractblock-usingdataassembly/7399 "2021-12-14T08:48:29Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![scotsman60](https://discourse.vtk.org/user_avatar/discourse.vtk.org/scotsman60/32/6000_2.png) [@scotsman60](https://discourse.vtk.org/u/scotsman60)
#### Post date: [December 14, 2021, 8:48am UTC](https://discourse.vtk.org/t/design-question-about-vtkextractblock-usingdataassembly/7399/1 "2021-12-14T08:48:29Z")

</div>

Hello!!!

First off - I added the space in the topic title to get around a “long word” warning when posting…

I’m using vtkExtractBlockUsingDataAssembly to extract blocks from a vtkPartitionedDataSetCollection and I can’t understand the design of the filter.  
If I set up the filter as shown below, nothing comes through the filter even though the selector is valid

```auto
        reader=vtk.vtkXMLPartitionedDataSetCollectionReader()
        reader.SetFileName(self.model_filename)

        self.assembly_block_filter = vtk.vtkExtractBlockUsingDataAssembly()
        test = self.assembly_block_filter.AddSelector('//*[@type="geom"]')
        self.assembly_block_filter.SetInputConnection(reader.GetOutputPort())
        self.assembly_block_filter.Update()
        out = self.assembly_block_filter.GetOutput()
        print('\n\nOutput assembly',out.GetDataAssembly().SerializeToXML(vtk.vtkIndent(2)))

```

If I insert the line highlighted below, everything works just fine

```auto
        self.assembly_block_filter = vtk.vtkExtractBlockUsingDataAssembly()
        **self.assembly_block_filter.SetAssemblyName('Model_1')**
        test = self.assembly_block_filter.AddSelector('//*[@type="geom"]')

```

Question : Why doesn’t the filter just use the root node of the vtkDataAssembly from the input vtkPartitionedDataSetCollection by default?

What is the recommended way of using this filter in a pipeline - does something like what is shown below make sense or is there a better approach? (This works, it just looks awkward…)

```auto
        reader=vtk.vtkXMLPartitionedDataSetCollectionReader()
        reader.SetFileName(self.model_filename)
        reader.Update()
        **root_assy_name = reader.GetOutput().GetDataAssembly().GetRootNodeName()** 

        self.assembly_block_filter = vtk.vtkExtractBlockUsingDataAssembly()
        **self.assembly_block_filter.SetAssemblyName(root_assy_name)** 
        test = self.assembly_block_filter.AddSelector('//*[@type="geom"]')
        self.assembly_block_filter.SetInputConnection(reader.GetOutputPort())
        self.assembly_block_filter.Update()
        out = self.assembly_block_filter.GetOutput()
        print('\n\nInput assembly',out.GetDataAssembly().SerializeToXML(vtk.vtkIndent(2)))

```

Finally, this filter works well to to extract the blocks selected by the selector, but it would be a great usability enhancement if there was way to return the blocks NOT selected by the selector. Maybe return the unselected blocks on another output or provide a switch to return the inverse set of Blocks?

Thanks in advance,

Doug
