# paraview.simple.reader to VTK object?

**URL:** https://discourse.paraview.org/t/paraview-simple-reader-to-vtk-object/3496
**Category:** ParaView Support
**Tags:** python, vtk
**Created:** [February 4, 2020, 12:33am UTC](https://discourse.paraview.org/t/paraview-simple-reader-to-vtk-object/3496 "2020-02-04T00:33:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![whophil](https://discourse.paraview.org/user_avatar/discourse.paraview.org/whophil/32/2934_2.png) [@whophil](https://discourse.paraview.org/u/whophil)
#### Post date: [February 4, 2020, 12:33am UTC](https://discourse.paraview.org/t/paraview-simple-reader-to-vtk-object/3496/1 "2020-02-04T00:33:02Z")

</div>

I am reading a binary TecPlot file in Python. I tried to use `vtk.vtkTecplotReader`, but this crashes. Instead, I have shifted my approach to use `paraview.simple.VisItTecplotBinaryReader`.

Ultimately I would like to use VTK filters on this data (for example, `vtk.vtkMassProperties()`)

Is there any way to get from an instance of `VisItTecplotBinaryReader` directly to a VTK data type such as `vtkUnstructuredGrid`? Right now I am using `paraview.simple.SaveData` to write the data to disk and then reloading it via `vtkXMLUnstructuredGridReader`. This is far from ideal.

```auto
from paraview.simple import *
import vtk

r = VisItTecplotBinaryReader(FileName=['data.plt'])
r.MeshStatus = ['Surface']
r.PointArrayStatus = []
SaveData('data.vtm', proxy=r)

r = vtk.vtkXMLUnstructuredGridReader()
r.SetFileName('data/data.i_0_0.vtu')
r.Update()
geom = r.GetOutput()

```

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [February 4, 2020, 1:43am UTC](https://discourse.paraview.org/t/paraview-simple-reader-to-vtk-object/3496/2 "2020-02-04T01:43:05Z")

</div>

Welcome to the ParaView community, Phillip!

You can do this with the `Fetch` function:

```python
from paraview import servermanager as sm
ugrid = sm.Fetch(r)

```

`ugrid` will be a `vtkUnstructuredGrid`.

`Fetch()` works even in client/server mode when the data resides on the server.

---

<div class="post-metadata">

### Author: ![whophil](https://discourse.paraview.org/user_avatar/discourse.paraview.org/whophil/32/2934_2.png) [@whophil](https://discourse.paraview.org/u/whophil)
#### Post date: [February 4, 2020, 2:54am UTC](https://discourse.paraview.org/t/paraview-simple-reader-to-vtk-object/3496/3 "2020-02-04T02:54:10Z")

</div>

Thanks! In this case, `ugrid` is actually a `vtkMultiBlockDataSet` - although, I would like it as an unstructured grid.

`vtk.GetBlock(0)` returns me another `vtkMultiBlockDataSet` - how can I get an actual `vtkUnstructuredGrid` out of this?

---

<div class="post-metadata">

### Author: ![CsatiZoltan](https://discourse.paraview.org/user_avatar/discourse.paraview.org/csatizoltan/32/6997_2.png) [@CsatiZoltan](https://discourse.paraview.org/u/CsatiZoltan)
#### Post date: [July 15, 2026, 3:23pm UTC](https://discourse.paraview.org/t/paraview-simple-reader-to-vtk-object/3496/4 "2026-07-15T15:23:58Z")

</div>

It is [recommended to use iterators](https://vtk.org/doc/nightly/html/classvtkMultiBlockDataSet.html#af5eb9a8a73cdbf29b05bf0ce1a9cbc51) instead of `GetBlock`. Here is a convenience wrapper around the VTK iterator:

```python
def iterate(multiblock_dataset):
    """Iterate through a vtkMultiBlockDataset.

    Args:
        multiblock_dataset (vtkMultiBlockDataSet): Over which we iterate

    Yields:
        Iterator[vtkDataObject]: A block in the multiblock dataset
    """
    iterator = multiblock_dataset.NewIterator()
    iterator.InitTraversal()
    while not iterator.IsDoneWithTraversal():
        block = iterator.GetCurrentDataObject()
        yield block
        iterator.GoToNextItem()

```

Then you can use this generator to loop through the unstructured grids in your multiblock dataset:

```python
for grid in iterate(your_multiblock_dataset):
    # do sth with the grid

```
