Hi all,
I rewrote a animation script with the new module servermanager in Paraview 3.7.
I don't understand why the moving is different with old module severmanager.
I had attached the 2 scripts in my email.
Thanks in advance for your kind help.
Regards,
Jona
from paraview.servermanager import *
from paraview import servermanager
# Initialization to set up some visualization
connection = servermanager.Connect('localhost')
cylinder = sources.CylinderSource()
view = CreateRenderView()
repr = CreateRepresentation(cylinder, view)
view.ResetCamera()
# Create an animation scene
scene = animation.AnimationScene()
# Add the view to the scene
scene.ViewModules = [view]
# Set the number of frame in one loop.
scene.NumberOfFrames = 1000
# Create an animation cue for the camera. This represents the "track" shown in
# the Animation View.
cue = animation.CameraAnimationCue()
cue.AnimatedProxy = view
# Add this cue to the scene.
scene.Cues = [cue]
# Now create keyframes. Let's say we are going to orbit around the object.
camera = view.GetActiveCamera()
num_of_keyframes = 10
for i in range(0, num_of_keyframes):
camera.Azimuth(360.0/num_of_keyframes)
keyframe = animation.CameraKeyFrame()
# set the value of the key frame to the current camera location.
keyframe.KeyTime = i*1.0/num_of_keyframes
keyframe.Position = camera.GetPosition()
keyframe.FocalPoint = camera.GetFocalPoint()
keyframe.ViewUp = camera.GetViewUp()
keyframe.ViewAngle = camera.GetViewAngle()
cue.KeyFrames.append(keyframe)
# Play the animation
scene.Play()
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from paraview.simple import *
Connect('localhost')
cylinder = Cylinder()
Show(cylinder)
ResetCamera()
# find view object
view = GetActiveView()
# Create an animation scene
scene = servermanager.animation.AnimationScene()
# Add the view to the scene
scene.ViewModules = [view]
# Set the number of frame in one loop.
scene.NumberOfFrames = 1000
# Create an animation cue for the camera. This represents the "track" shown in cuethe Animation View.
cue = servermanager.animation.KeyFrameAnimationCue()
cue.AnimatedProxy = [view]
# Add this cue to the scene.
scene.Cues = [cue]
# Now create keyframes. Let's say we are going to orbit around the object.
camera = view.GetActiveCamera()
num_of_keyframes = 10
listKeyframe = []
for i in range(0, num_of_keyframes):
camera.Azimuth(360.0/num_of_keyframes)
keyframe = servermanager.animation.CameraKeyFrame()
# set the value of the key frame to the current camera location.
keyframe.KeyTime = i*1.0/num_of_keyframes
keyframe.Position = camera.GetPosition()
keyframe.FocalPoint = camera.GetFocalPoint()
keyframe.ViewUp = camera.GetViewUp()
keyframe.ViewAngle = camera.GetViewAngle()
listKeyframe.append(keyframe)
#cue.KeyFrames.append(keyframe) because 'append' don't exist for this object
cue.KeyFrames = listKeyframe
# Play the animation
scene.Play()
_______________________________________________
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
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview