Difference between revisions of "ParaView/Python/Dealing with time"
|Line 30:||Line 30:|
Latest revision as of 13:38, 16 October 2018
If a reader or a filter supports time, it is easy to request a certain time step from Python. All time requests are set on views, which then propagate them to the representations which then propagate them to the visualization pipeline. Here is an example demonstrating how a time request can be made.
>>> Show(ExodusIIReader(FileName=".../can.ex2")) >>> Render() # Get a nice view angle >>> cam = GetActiveCamera() >>> cam.Elevation(45) >>> Render() # Check the current view time >>> view = GetActiveView() >>> view.ViewTime 0.0 >>> reader = GetActiveSource() >>> reader.TimestepValues [0.0, 0.00010007373930420727, 0.00019990510190837085, 0.00029996439116075635, 0.00040008654468692839, ...] >>> tsteps = reader.TimestepValues # Let’s be fancy and use a time annotation filter. This will show the # current time value of the reader as text in the corner of the view. >>> annTime = AnnotateTimeFilter(reader) # Show the filter >>> Show(annTime) # Look at a few time steps. Note that the time value is requested not # the time step index. >>> view.ViewTime = tsteps >>> Render() >>> view.ViewTime = tsteps >>> Render()
Back to ParaView/PythonRecipes.