3

I am trying to save an .avi animation in ParaView via python script. The script I wrote works, nonetheless, the animation corresponds to a steady frame. What should I change in order to obtain an animation with all 10 frames from my ParaView model?

Here is my script (movie.py):

from paraview.simple import *
movie = servermanager.animation.AnimationScene()
movie.ViewModules = [GetActiveView()]
movie.NumberOfFrames = 10
movie_writer = servermanager.vtkSMAnimationSceneImageWriter()
movie_writer.SetFileName("/Users/wbr/Desktop/movie.avi")
movie_writer.SetFrameRate(1)
movie_writer.SetQuality(2)
movie_writer.SetAnimationScene(movie.SMProxy)
movie_writer.Save()
Ali_Sh
  • 2,667
  • 3
  • 43
  • 66
Wbr
  • 103
  • 1
  • 7

3 Answers3

0

Here is the solution I found to export an ParaView Animation programmatically:

reader = GetActiveSource()
view = GetActiveView()
AnimateReader(reader,view,filename="../movie.avi")

The only problem is that I cannot set the Frame rate. Any suggestions?

Wbr
  • 103
  • 1
  • 7
  • Or even better (easier): paraview.simple.WriteAnimation(filename, **params), check: http://www.paraview.org/ParaView3/Doc/Nightly/www/py-doc/paraview.simple.html – Wbr Aug 17 '14 at 20:34
0

With ParaView 4.2 (RC1), this is the script I get when I generate a Python trace for the action of saving an animation.

#### import the simple module from the paraview
from paraview.simple import *

# save animation images/movie
WriteAnimation('/tmp/movie.ogv', Magnification=1, FrameRate=15.0, Compression=True)
Utkarsh
  • 1,492
  • 1
  • 11
  • 19
  • How do you trace actions on ParaView? I am currently trying to select points programmatically and plot them over time. I got some hints from .psvm (state files), but it only works if the point ID is known. In my case, I am trying to select a point based on coordinates. – Wbr Sep 17 '14 at 19:21
  • Open paraview > Tools > Start Trace > Accept Defaults > Do what you need to do > Stop Trace > Investigate code in script editor – user32882 Jul 21 '17 at 14:02
0

Latest version (Movie with white background):

from paraview.simple import *
viewModel = GetActiveView()
viewModel.Background = [1,1,1]
Show()
Render()
paraview.simple.WriteAnimation(filename="/Users/wilsondasilva/Desktop/movie.avi",FrameRate=15.0)
Wbr
  • 103
  • 1
  • 7