[Paraview] Animate a solid with a specific time serie

Moreland, Kenneth kmorel at sandia.gov
Fri Feb 27 10:43:15 EST 2015


Madalena,

The time units in ParaView can be anything you want them to be: minutes, seconds, epochs, jiffies, whatever. ParaView does not manage the units for time; it is an exercise for the user to ensure that all time values refer to the same scale (and bias).

You can control the time range (the time values where the animation starts and stops) through the animation scene object returned from GetAnimationScene(). The StartTime and EndTime fields can be set to the start and end times you want your animation to be. The following code sets the animation range to be compatible with the keyframe times you describe below.


# get animation scene

animationScene1 = GetAnimationScene()


# Properties modified on animationScene1

animationScene1.StartTime = 1.0

animationScene1.EndTime = 3.0

If you want to control the playback of the animation in terms of frames or speed, you can do so with the PlayMode and other parameters. For example, in the email below you mentioned the time value in terms of minutes. If you wanted you keyframes to play over the course of 2 minutes (the time between T = 1min and T = 3min is 2 minutes), you can set the PlayMode to 'Real Time' and set the Duration field to 120. (The duration is measured in seconds, so 2 minutes converts to 120 seconds.) You can do that as follows:


animationScene1.PlayMode = 'Real Time'

animationScene1.Duration = 120

Alternately, you can request a certain number of frames in the animation. You cannot specify arbitrary time values for every frame, ParaView evenly spaces them between the start and end time. But if your keyframes are evenly spaced it is easy to align them. So if you want a frame at every keyframe in the example below, you can use the following code.


animationScene1.PlayMode = 'Sequence'

animationScene1.NumberOfFrames = 3

In the GUI, all of these controls are in the Animation View widget. You can learn more about the animation view in the ParaView tutorial (http://www.paraview.org/Wiki/The_ParaView_Tutorial), specifically in Exercise 2.18. These tools are also documented in the ParaView User's Guide (http://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v4.3&type=data&os=all&downloadFile=TheParaViewGuide-v4.3-CC-Edition.pdf), specifically in Section 7.2. Once you know how to set these controls in the GUI, you can use ParaView script trace to learn the appropriate Python commands.

-Ken

From: "Madalena S. Malhadas" <nenasantos at hotmail.com<mailto:nenasantos at hotmail.com>>
Date: Friday, February 27, 2015 at 3:31 AM
To: Kenneth Moreland <kmorel at sandia.gov<mailto:kmorel at sandia.gov>>, Jeff Becker <jeffrey.c.becker at nasa.gov<mailto:jeffrey.c.becker at nasa.gov>>, Utkarsh Ayachit <utkarsh.ayachit at kitware.com<mailto:utkarsh.ayachit at kitware.com>>
Cc: ParaView <paraview at paraview.org<mailto:paraview at paraview.org>>
Subject: [EXTERNAL] Animate a solid with a specific time serie


Deal all,
I want to animate a solid that moves acording to specific time serie (time, position). By recording the code via python shell i see that appears two simple keywords  that moves the solid by proving specific values.

example:

# get animation track
box1CenterTrack = GetAnimationTrack('Center', index=0, proxy=box1)

# create keyframes for  animation track
keyFrame0 = CompositeKeyFrame()
keyFrame0.KeyTime = 0.0
keyFrame0.KeyValues = 60.0

keyFrame1 = CompositeKeyFrame()
keyFrame1.KeyTime = 1.0
keyFrame1.KeyValues = 0.0

# initialize the animation track
box1CenterTrack.KeyFrames = [keyFrame0, keyFrame1]


My doubt is the place where is possible to provide my time serie of time and position. And what is the time units of KeyTime? The KeyValues is position if i understand the sample that i run.

Instead a specific time serie it is possible to provide each line of time serie as KeyTime and Kay Value, and then for the animation track call them all.

Example:
time (minuts) position (m)
1 7.2                      Converted in script:      keyFrame1.KeyTime = 1.0; keyFrame1.KeyValues = 7.2
2 9.374                 Converted in script:      keyFrame2.KeyTime = 2.0; keyFrame2.KeyValues = 9.374
3 11.548               Converted in script:      keyFrame1.KeyTime = 3.0; keyFrame1.KeyValues = 11.548

                                                                              box1CenterTrack.KeyFrames = [keyFrame0, keyFrame1, KeyFrame 3 etc..]


Is possible to do sometinh like that? Convert my time serie of time and position to each keytime and keyvalues in script?

Kind regards
Madalena
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150227/20dd276c/attachment.html>


More information about the ParaView mailing list