# vtkAngularPeriodicFilter vtkCutter

**URL:** https://discourse.paraview.org/t/vtkangularperiodicfilter-vtkcutter/11465
**Category:** ParaView Support
**Tags:** python, vtk
**Created:** [February 22, 2023, 12:43pm UTC](https://discourse.paraview.org/t/vtkangularperiodicfilter-vtkcutter/11465 "2023-02-22T12:43:44Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Rigel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@Rigel](https://discourse.paraview.org/u/Rigel)
#### Post date: [February 22, 2023, 12:43pm UTC](https://discourse.paraview.org/t/vtkangularperiodicfilter-vtkcutter/11465/1 "2023-02-22T12:43:45Z")

</div>

Hi,

I have a 3D VTK dataset and I want to post-process it in a Python script (using `pvbatch`). Everything works well up to the application of the `vtkAngularPeriodicFilter`:

```auto
# Loop through snapshots
for i in range(valid_iterations_id[0], len(iterations)):
    print("Processing iteration", i, "out of", len(iterations))

    # Read the VTK data
    data = vtkutils.read_vtk(folder + fileName[i])
    print(data.GetOutput())

    # Don't try using clip: too slow
    #data = vtkutils.clip_vtk(data,Zmin)

    # Remove part of data before Zmin
    data = vtkutils.extractGeometry_vtk(data,Zmin)
    print(data.GetOutput())

    # Remove part of data after Zmax
    data = vtkutils.extractGeometry_vtk(data,Zmax)
    print(data.GetOutput())

    # Remove part of data beyond cylinder radius
    data = vtkutils.extractGeometry_vtk(data,cyl)
    print(data.GetOutput())

    # Apply angular periodic filter
    data = vtkutils.angularPeriodic_vtk(data, 45., 2, [0., 0., 0.])
    print(data.GetOutput())

    # Slice through data
    data = vtkutils.cut_vtk(data, cut)
    print(data.GetOutput())

```

Then the code crashes when attempting to execute the vtkCutter with the following error message:

`( 332.150s) [pvbatch]vtkGenericDataArray.txx:268 ERR| 27vtkAngularPeriodicDataArrayIfE (0x10d227d0): GetVoidPointer is not supported by this class.`

Could you help me figure out what is going on?

Thanks a lot,

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 22, 2023, 12:53pm UTC](https://discourse.paraview.org/t/vtkangularperiodicfilter-vtkcutter/11465/2 "2023-02-22T12:53:11Z")

</div>

> [@Rigel](#):
>
> `cut_vtk`

Which filter is behind this ? if it is actual vtkCutter, then it should be fixed to not rely on GetVoidPointer. In any case, you can work around this by using [SetComputeRotationsOnTheFly](https://vtk.org/doc/nightly/html/classvtkAngularPeriodicFilter.html#a43d08e3f34e741b1b6ee429be742cb9b) (bool)

---

<div class="post-metadata">

### Author: ![Rigel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@Rigel](https://discourse.paraview.org/u/Rigel)
#### Post date: [February 22, 2023, 1:02pm UTC](https://discourse.paraview.org/t/vtkangularperiodicfilter-vtkcutter/11465/3 "2023-02-22T13:02:43Z")

</div>

Thanks Mathieu for your reply. Here is the definition of `cut_vtk`:

```auto
def cut_vtk(data,plane):
    cutter = vtk.vtkCutter()
    cutter.SetCutFunction(plane)
    cutter.SetInputConnection(data.GetOutputPort())
    cutter.Update()
    return cutter

```

It is indeed using `vtkCutter`. Here is, on its turn, the definition of `angularPeriodic_vtk`:

```auto
def angularPeriodic_vtk(data, rotationAngle, rotationAxis, center):
    angularPeriodic = vtk.vtkAngularPeriodicFilter()
    angularPeriodic.SetInputConnection(data.GetOutputPort())
    angularPeriodic.SetRotationAngle(rotationAngle)
    angularPeriodic.SetRotationAxis(rotationAxis)
    angularPeriodic.SetCenter(center)
    angularPeriodic.Update()
    return angularPeriodic

```

As far as I understand the documentation, _compute rotations on the fly_ is the default behaviour for `vtkAngularPeriodicFilter`, isn’t it?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 22, 2023, 1:08pm UTC](https://discourse.paraview.org/t/vtkangularperiodicfilter-vtkcutter/11465/4 "2023-02-22T13:08:12Z")

</div>

Yes, that is correct, you should set it to false.

---

<div class="post-metadata">

### Author: ![Rigel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@Rigel](https://discourse.paraview.org/u/Rigel)
#### Post date: [March 2, 2023, 9:56am UTC](https://discourse.paraview.org/t/vtkangularperiodicfilter-vtkcutter/11465/5 "2023-03-02T09:56:26Z")

</div>

Mathieu, I managed to pass by the crash, but the following filter (`vtkCutter`) is still not working… Would you mind taking a look at my new topic?

[https://discourse.paraview.org/t/vtkangularperiodicfilter-vtkcutter-2/](https://discourse.paraview.org/t/vtkangularperiodicfilter-vtkcutter-2/)

Thanks a lot,

---

<div class="post-metadata">

### Author: ![Rigel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@Rigel](https://discourse.paraview.org/u/Rigel)
#### Post date: [March 13, 2023, 10:26am UTC](https://discourse.paraview.org/t/vtkangularperiodicfilter-vtkcutter/11465/6 "2023-03-13T10:26:02Z")

</div>

However, I must say that setting _compute rotations on the fly_ to false kills the performance of your code (it is much slower) and may become prohibitive for large datasets…
