# vtkMultiBlockMergeFilter usage

**URL:** https://discourse.paraview.org/t/vtkmultiblockmergefilter-usage/7017
**Category:** ParaView Support
**Tags:** python
**Created:** [April 21, 2021, 9:39am UTC](https://discourse.paraview.org/t/vtkmultiblockmergefilter-usage/7017 "2021-04-21T09:39:46Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![bmxam](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/b38774/32.png) [@bmxam](https://discourse.paraview.org/u/bmxam)
#### Post date: [April 21, 2021, 9:39am UTC](https://discourse.paraview.org/t/vtkmultiblockmergefilter-usage/7017/1 "2021-04-21T09:39:46Z")

</div>

Hi everyone,

I’m brand new in the world of _Programmable Filter_. In my python script, I’m trying to merge the blocks of a _Multi-block Dataset_ (and then some additionnal steps that are already working). With the GUI, I simply use the _Merge Blocks_ filter.

I’ve tried the following:

```
input0 = inputs[0]
print(intput0) # -> paraview.vtk.numpy_interface.dataset_adapter.CompositeDataSet

if input0.IsA("vtkCompositeDataSet"):    
    from paraview.vtk.vtkFiltersGeneral import vtkMultiBlockMergeFilter
    from vtk.numpy_interface import dataset_adapter as dsa
    mbmf = vtkMultiBlockMergeFilter()
    mbmf.SetInputData(input0.VTKObject)
    mbmf.Update()
    merged = dsa.WrapDataObject(mbmf.GetOutput())

    print(merged) # -> vtk.numpy_interface.dataset_adapter.CompositeDataSet

```

but it seems that the `merged` object is still a `CompositeDataSet` (while I’m expecting something like an UnstructuredGrid). In the CXX doxygen I see a `merge` method but I don’t know how to use it (if needed).

Any help is welcome!

---

<div class="post-metadata">

### Author: ![lhofmann](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/9e8a1a/32.png) [@lhofmann](https://discourse.paraview.org/u/lhofmann)
#### Post date: [April 21, 2021, 10:47am UTC](https://discourse.paraview.org/t/vtkmultiblockmergefilter-usage/7017/2 "2021-04-21T10:47:11Z")

</div>

Merge Blocks uses `vtkDataObjectTreeToPointSetFilter`, which is not a VTK filter but comes with ParaView:

```python
from paraview.modules.vtkPVVTKExtensionsMisc import vtkDataObjectTreeToPointSetFilter

```

---

<div class="post-metadata">

### Author: ![bmxam](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/b38774/32.png) [@bmxam](https://discourse.paraview.org/u/bmxam)
#### Post date: [April 21, 2021, 11:40am UTC](https://discourse.paraview.org/t/vtkmultiblockmergefilter-usage/7017/3 "2021-04-21T11:40:46Z")

</div>

Thanks.

However your line lead to `ImportError: cannot import name 'vtkDataObjectTreeToPointSetFilter' from 'paraview.modules.vtkPVVTKExtensionsMisc'` with _ParaView-5.9.0-RC4-MPI-Linux-Python3.8-64bit_.

But following your lead, I found a `vtkMergeBlocks` in `paraview.modules.vtkPVVTKExtensionsMisc` that did the job. I ended up with:

```auto
input0 = inputs[0]

if input0.IsA("vtkCompositeDataSet"):
    from paraview.modules.vtkPVVTKExtensionsMisc import vtkMergeBlocks
    from vtk.numpy_interface import dataset_adapter as dsa
    mergeFilter = vtkMergeBlocks()
    mergeFilter.SetInputData(input0.VTKObject)
    mergeFilter.Update()
    input0 = dsa.WrapDataObject(mergeFilter.GetOutput())

```

---

<div class="post-metadata">

### Author: ![bmxam](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/b38774/32.png) [@bmxam](https://discourse.paraview.org/u/bmxam)
#### Post date: [April 21, 2021, 11:42am UTC](https://discourse.paraview.org/t/vtkmultiblockmergefilter-usage/7017/4 "2021-04-21T11:42:12Z")

</div>

Is it possible to find the `paraview.*.vtk???` class/module corresponding to a given filter in the GUI?

---

<div class="post-metadata">

### Author: ![lhofmann](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/9e8a1a/32.png) [@lhofmann](https://discourse.paraview.org/u/lhofmann)
#### Post date: [April 21, 2021, 1:07pm UTC](https://discourse.paraview.org/t/vtkmultiblockmergefilter-usage/7017/5 "2021-04-21T13:07:21Z")

</div>

In the Python shell, `GetActiveSource().GetVTKClassName()` gives you the class name. You can then locate its VTK module by searching the ParaView source code.
