Move Source (disk or sphere) according to time dependent function

I need to overlay a disk or sphere over my data and move it along a given function, that depends on the simulation time t. So e.g. I want a disk to move along the x-axis during the simulation time - is this possible? At the moment I create the disk by hand, which is nice for one single timestep, automating this would be a great help.

Thanks in advance,


I found a similar question here: and there a similar problem could be solved with a ProgrammableFilter. So I tried this on my problem too and at the moment I have this programmable filter on my sphere:

from vtk import vtkDataObject
from paraview.simple import GetActiveView

pdi = self.GetPolyDataInput()
pdo = self.GetPolyDataOutput()
newPoints = vtk.vtkPoints()
numPoints = pdi.GetNumberOfPoints()

view = GetActiveView()
time = view.ViewTime

for i in range(0, numPoints):
coord = pdi.GetPoint(i)
x, y, z = coord[:3]
x = x + time
y = y
z = z
newPoints.InsertPoint(i, x, y, z)

this works, when I trigger it manually each timestep. Is it possible, that the filter is executed automatically on each new timestep?

You can do this with some of the animation controls.

Let’s say you add a Sphere source. It’s name in the Pipeline Browser will be “Sphere1”. Open up the Animation View. In the popup menu to the right of the blue plus sign, select, “Python”, then click the plus sign. In the track to the right of the new animation trick, double-click your mouse. In the “Edit Python Animation Track” dialog that appears, enter this script:

from paraview.simple import *

def start_cue(self): pass

def tick(self):
  tk = GetTimeKeeper()
  t = tk.Time
  center = [t, 0, 0]
  s = FindSource('Sphere1')
  s.Center = center

def end_cue(self): pass

This will move the sphere along the x-axis according to ParaView’s current time.