Changes between Version 12 and Version 13 of Examples/ParaviewAnimating


Ignore:
Timestamp:
08/16/18 09:02:12 (6 years ago)
Author:
Herwig Zilken
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Examples/ParaviewAnimating

    v12 v13  
    189189
    190190== !PythonAnimationCue ==
    191 To be done
    192 
     191Also a Python script can be used in an animation cue. In the Python script three functions can be implemented:
     192* start_cue: is executed once at the beginning of the animation
     193* tick: is executed every time step
     194* end_cue: is executed once at the end of the animation
     195
     196Here is an example of such a script. In this example the value of the timestep is translated into a date string (e.g. 2018-01-01) and displayed in the scene via a text source with name "Text1".
     197{{{
     198#!python
     199from paraview.simple import *
     200from datetime import date
     201from datetime import timedelta
     202
     203def start_cue(self): pass
     204
     205def tick(self):
     206    view = GetActiveView()
     207    time = int(view.ViewTime)
     208    dat = date(2000,1,1) + timedelta(days=time)
     209    tx = FindSource("Text1")
     210    tx.Text = repr(dat.year) + "-" + '{:02d}'.format(dat.month) + "-" + '{:02d}'.format(dat.day)
     211
     212def end_cue(self): pass
     213}}}