# Translate source object based on time

**URL:** https://discourse.paraview.org/t/translate-source-object-based-on-time/5813
**Category:** ParaView Support
**Tags:** python
**Created:** [November 16, 2020, 1:21pm UTC](https://discourse.paraview.org/t/translate-source-object-based-on-time/5813 "2020-11-16T13:21:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![fredrik](https://discourse.paraview.org/user_avatar/discourse.paraview.org/fredrik/32/5351_2.png) [@fredrik](https://discourse.paraview.org/u/fredrik)
#### Post date: [November 16, 2020, 1:21pm UTC](https://discourse.paraview.org/t/translate-source-object-based-on-time/5813/1 "2020-11-16T13:21:01Z")

</div>

I would like to translate a disk (added from the GUI `Sources > Disk`) as a function of the time. I found [Move Source (disk or sphere) according to time dependent function](https://discourse.paraview.org/t/move-source-disk-or-sphere-according-to-time-dependent-function/2251/2) which does this for a `Sphere`, but the same method does not seem to apply here since `Center` is not a property of the `Disk` object.

I would imagine it is possible do this from Python similar to the linked question, but using some other function and not setting the property directly. Here is some incomplete pseudo-code for what I want to achieve:

```python
from paraview.simple import *

def start_cue(self): pass

def tick(self):
  tk = GetTimeKeeper()
  t = tk.Time
  center = [t, 0, 0]
  s = FindSource('Disk1')
  
  # TODO: Apply translation such that the disk is centered at `center`

def end_cue(self): pass

```

---

<div class="post-metadata">

### Author: ![nicolas.vuaille](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nicolas.vuaille/32/5873_2.png) [@nicolas.vuaille](https://discourse.paraview.org/u/nicolas.vuaille)
#### Post date: [November 16, 2020, 3:02pm UTC](https://discourse.paraview.org/t/translate-source-object-based-on-time/5813/2 "2020-11-16T15:02:58Z")

</div>

You can add a Transform Filter on your disk and then set the `Translate` property of the transform.

---

<div class="post-metadata">

### Author: ![fredrik](https://discourse.paraview.org/user_avatar/discourse.paraview.org/fredrik/32/5351_2.png) [@fredrik](https://discourse.paraview.org/u/fredrik)
#### Post date: [November 19, 2020, 12:18pm UTC](https://discourse.paraview.org/t/translate-source-object-based-on-time/5813/3 "2020-11-19T12:18:16Z")

</div>

Thanks, I’ll try that. Do you know where I can find an example of how to use such a filter from Python? I didn’t find any in the documentation, but perhaps I was looking in the wrong places.

---

<div class="post-metadata">

### Author: ![nicolas.vuaille](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nicolas.vuaille/32/5873_2.png) [@nicolas.vuaille](https://discourse.paraview.org/u/nicolas.vuaille)
#### Post date: [November 19, 2020, 12:42pm UTC](https://discourse.paraview.org/t/translate-source-object-based-on-time/5813/4 "2020-11-19T12:42:32Z")

</div>

You can find an overview here: [https://docs.paraview.org/en/latest/UsersGuide/filteringData.html?highlight=transform#transform](https://docs.paraview.org/en/latest/UsersGuide/filteringData.html?highlight=transform#transform)

Otherwise, to create python script I recommend to use the Python trace ([https://docs.paraview.org/en/latest/UsersGuide/introduction.html?highlight=python%20trace#tracing-actions-for-scripting](https://docs.paraview.org/en/latest/UsersGuide/introduction.html?highlight=python%20trace#tracing-actions-for-scripting)). It records in python what you do in the GUI.
