[prev in list] [next in list] [prev in thread] [next in thread] 

List:       paraview
Subject:    Re: [Paraview] Animate a solid with a specific time serie
From:       "Moreland, Kenneth" <kmorel () sandia ! gov>
Date:       2015-02-27 15:43:15
Message-ID: D115D7A9.1A8B2%kmorel () sandia ! gov
[Download RAW message or body]

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@hotmail.com<mailto:nenasantos@hotmail.com>>
Date: Friday, February 27, 2015 at 3:31 AM
To: Kenneth Moreland <kmorel@sandia.gov<mailto:kmorel@sandia.gov>>, Jeff Becker \
<jeffrey.c.becker@nasa.gov<mailto:jeffrey.c.becker@nasa.gov>>, Utkarsh Ayachit \
                <utkarsh.ayachit@kitware.com<mailto:utkarsh.ayachit@kitware.com>>
Cc: ParaView <paraview@paraview.org<mailto:paraview@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


[Attachment #3 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="qrichtext" content="1">
<style type="text/css">
p, li { white-space: pre-wrap; }
</style>
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: \
after-white-space; color: rgb(0, 0, 0);"> <div style="font-family: Calibri, \
sans-serif; font-size: 14px;"> <div>
<div>Madalena,</div>
<div><br>
</div>
<div>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).</div> </div>
</div>
<div style="font-family: Calibri, sans-serif; font-size: 14px;"><br>
</div>
<div style="font-family: Calibri, sans-serif; font-size: 14px;">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.</div> <div style="font-family: Calibri, sans-serif; font-size: \
14px;"><br> </div>
<div style="font-family: Calibri, sans-serif; font-size: 14px;">
<p style="margin: 0px;"><!--StartFragment--><span style="font-family: 'Courier New', \
courier; font-style: italic; color: rgb(64, 128, 128);"># get animation \
scene</span></p> <pre style="margin-top: 0px; margin-bottom: 0px;"><span \
style="font-family: 'Courier New', courier;">animationScene1 </span><span \
style="font-family: 'Courier New', courier; color: rgb(102, 102, 102);">=</span><span \
style="font-family: 'Courier New', courier;"> GetAnimationScene()</span></pre> <pre \
style="margin-top: 0px; margin-bottom: 0px; font-family: 'Courier \
New,courier';"><br></pre> <pre style="margin-top: 0px; margin-bottom: 0px;"><span \
style="font-family: 'Courier New', courier; font-style: italic; color: rgb(64, 128, \
128);"># Properties modified on animationScene1</span></pre> <pre style="margin-top: \
0px; margin-bottom: 0px;"><span style="font-family: 'Courier New', \
courier;">animationScene1.StartTime = 1.0</span></pre> <pre style="margin-top: 0px; \
margin-bottom: 0px;"><span style="font-family: 'Courier New', \
courier;">animationScene1</span><span style="font-family: 'Courier New', courier; \
color: rgb(102, 102, 102);">.</span><span style="font-family: 'Courier New', \
courier;">EndTime </span><span style="font-family: 'Courier New', courier; color: \
rgb(102, 102, 102);">=</span><span style="font-family: 'Courier New', courier;"> \
3</span><span style="font-family: 'Courier New', courier; color: rgb(102, 102, \
102);">.0</span><!--EndFragment--></pre> </div>
<div style="font-family: Calibri, sans-serif; font-size: 14px;"><br>
</div>
<div style="font-family: Calibri, sans-serif; font-size: 14px;">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:</div>
<div style="font-family: Calibri, sans-serif; font-size: 14px;"><br>
</div>
<div>
<p style="margin: 0px;"><!--StartFragment--><font face="Courier \
New">animationScene1<span style="color: rgb(102, 102, 102);">.</span>PlayMode <span \
style="color: rgb(102, 102, 102);">=</span> <span style="color: rgb(186, 33, 33);"> \
'Real Time'</span></font></p> <pre style="margin-top: 0px; margin-bottom: 0px; color: \
rgb(186, 33, 33);"><font face="Courier New"><span style="font-size: 14px;"><span \
style="color: rgb(0, 0, 0);">animationScene1</span><span style="color: rgb(102, 102, \
102);">.</span><span style="color: rgb(0, 0, 0);">Duration </span><span style="color: \
rgb(102, 102, 102);">=</span><span style="color: rgb(0, 0, 0);"> </span><span \
style="color: rgb(102, 102, 102);">120</span></span></font></pre> </div>
<div style="font-family: Calibri, sans-serif; font-size: 14px;"><br>
</div>
<div style="font-family: Calibri, sans-serif; font-size: 14px;">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.</div> <div style="font-family: Calibri, sans-serif; font-size: 14px;"><br>
</div>
<div style="font-size: 14px;">
<p style="margin: 0px;"><span style="font-family: 'Courier \
New';">animationScene1</span><span style="font-family: 'Courier New'; color: rgb(102, \
102, 102);">.</span><span style="font-family: 'Courier New';">PlayMode </span><span \
style="font-family: 'Courier New'; color: rgb(102, 102, 102);">=</span><span \
style="font-family: 'Courier New';"> </span><span style="font-family: 'Courier New'; \
color: rgb(186, 33, 33);">'Sequence'</span></p> <pre style="margin-top: 0px; \
margin-bottom: 0px; color: rgb(186, 33, 33);"><span style="font-family: 'Courier \
New'; color: rgb(0, 0, 0);">animationScene1</span><span style="font-family: 'Courier \
New'; color: rgb(102, 102, 102);">.</span><span style="font-family: 'Courier New'; \
color: rgb(0, 0, 0);">NumberOfFrames </span><span style="font-family: 'Courier New'; \
color: rgb(102, 102, 102);">=</span><span style="font-family: 'Courier New'; color: \
rgb(0, 0, 0);"> </span><span style="font-family: 'Courier New'; color: rgb(102, 102, \
102);">3</span></pre> </div>
<div style="font-family: Calibri, sans-serif; font-size: 14px;"><br>
</div>
<div style="font-family: Calibri, sans-serif; font-size: 14px;">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 (<a \
href="http://www.paraview.org/Wiki/The_ParaView_Tutorial">http://www.paraview.org/Wiki/The_ParaView_Tutorial</a>),
  specifically in Exercise 2.18. These tools are also documented in the ParaView \
User's Guide (<a href="http://www.paraview.org/paraview-downloads/download.php?submit= \
Download&amp;version=v4.3&amp;type=data&amp;os=all&amp;downloadFile=TheParaViewGuide-v \
4.3-CC-Edition.pdf">http://www.paraview.org/paraview-downloads/download.php?submit=Dow \
nload&amp;version=v4.3&amp;type=data&amp;os=all&amp;downloadFile=TheParaViewGuide-v4.3-CC-Edition.pdf</a>),
  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.</div> \
<div style="font-family: Calibri, sans-serif; font-size: 14px;"><br> </div>
<div style="font-family: Calibri, sans-serif; font-size: 14px;">-Ken</div>
<div style="font-family: Calibri, sans-serif; font-size: 14px;"><br>
</div>
<span id="OLK_SRC_BODY_SECTION" style="font-family: Calibri, sans-serif; font-size: \
14px;"> <div style="font-family:Calibri; font-size:11pt; text-align:left; \
color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: \
0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; \
BORDER-RIGHT: medium none; PADDING-TOP: 3pt"> <span style="font-weight:bold">From: \
</span>&quot;Madalena S. Malhadas&quot; &lt;<a \
href="mailto:nenasantos@hotmail.com">nenasantos@hotmail.com</a>&gt;<br> <span \
style="font-weight:bold">Date: </span>Friday, February 27, 2015 at 3:31 AM<br> <span \
style="font-weight:bold">To: </span>Kenneth Moreland &lt;<a \
href="mailto:kmorel@sandia.gov">kmorel@sandia.gov</a>&gt;, Jeff Becker &lt;<a \
href="mailto:jeffrey.c.becker@nasa.gov">jeffrey.c.becker@nasa.gov</a>&gt;, Utkarsh \
Ayachit &lt;<a href="mailto:utkarsh.ayachit@kitware.com">utkarsh.ayachit@kitware.com</a>&gt;<br>
 <span style="font-weight:bold">Cc: </span>ParaView &lt;<a \
href="mailto:paraview@paraview.org">paraview@paraview.org</a>&gt;<br> <span \
style="font-weight:bold">Subject: </span>[EXTERNAL] Animate a solid with a specific \
time serie<br> </div>
<div><br>
</div>
<div><style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
<div class="hmmessage">
<div dir="ltr"><br>
Deal all,<style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}

--></style><style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}


--></style><style><!--
.ExternalClass p, .ExternalClass li {
white-space:pre-wrap;
}


--></style><style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}


--></style>
<div>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 &nbsp;that moves the solid by proving specific values.</div> <div><br>
</div>
<div>example:</div>
<div><br>
</div>
<div>
<div># get animation track</div>
<div>box1CenterTrack = GetAnimationTrack('Center', index=0, proxy=box1)</div>
<div><br>
</div>
<div># create keyframes for &nbsp;animation track</div>
<div>keyFrame0 = CompositeKeyFrame()</div>
<div>keyFrame0.KeyTime = 0.0</div>
<div>keyFrame0.KeyValues = 60.0</div>
<div><br>
</div>
<div>keyFrame1 = CompositeKeyFrame()</div>
<div>keyFrame1.KeyTime = 1.0</div>
<div>keyFrame1.KeyValues = 0.0</div>
<div><br>
</div>
<div># initialize the animation track</div>
<div>box1CenterTrack.KeyFrames = [keyFrame0, keyFrame1]</div>
<div><br>
</div>
</div>
<div><br>
</div>
<div>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.</div> <div><br>
</div>
<div>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.</div> \
<div><br> </div>
<div>Example:</div>
<div>time (minuts) position (m)</div>
<div>
<div>1<span class="Apple-tab-span" style="white-space:pre"> </span>7.2 &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Converted in script: \
&nbsp; &nbsp; &nbsp;<span style="font-size: 12pt;">keyFrame1.KeyTime = \
1.0;&nbsp;</span><span style="font-size: 12pt;">keyFrame1.KeyValues = 7.2</span><span \
style="font-size: 12pt;">&nbsp;  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp;&nbsp;</span></div> <div>2<span class="Apple-tab-span" style="white-space:pre"> \
</span>9.374 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span \
style="font-size: 12pt;">Converted in script: &nbsp; &nbsp; &nbsp;</span><span \
style="font-size: 12pt;">keyFrame2.KeyTime = 2.0;&nbsp;</span><span style="font-size: \
12pt;">keyFrame2.KeyValues  = 9.374</span><span style="font-size: 12pt;">&nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></div> <div>3<span \
class="Apple-tab-span" style="white-space:pre"> </span>11.548 &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="font-size: 12pt;">Converted in script: \
&nbsp; &nbsp; &nbsp;</span><span style="font-size: 12pt;">keyFrame1.KeyTime = \
3.0;&nbsp;</span><span style="font-size: 12pt;">keyFrame1.KeyValues  = \
11.548</span></div> <div><span style="font-size: 12pt;"><br>
</span></div>
<div><span style="font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box1CenterTrack.KeyFrames = \
[keyFrame0, keyFrame1, KeyFrame 3 etc..]</span><span style="font-size: 12pt;">&nbsp; \
&nbsp; &nbsp; &nbsp;&nbsp;</span></div> <div><br>
</div>
</div>
<div><br>
</div>
<div>Is possible to do sometinh like that? Convert my time serie of time and position \
to each keytime and keyvalues in script?</div> <div><br>
</div>
<div>Kind regards</div>
<div>Madalena</div>
</div>
</div>
</div>
</span>
</body>
</html>



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

--===============0433010317==--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic