Zetison |
May 5, 2016 05:39 |
Python script for creating a movie
I have two sets of files (.vtu files) which are combined into two .pvd files. My script for creating a visualization is the following
Code:
from paraview.simple import *
import os
pth = "C:/Users/Jon Vegard/Dropbox/work/matlab/results/SS_RBC_BI/paraviewResults"
os.chdir(pth)
fileName = "SS_RBC_BI_0_1_exact"
inputFilename = "%s/%s_solid.pvd" % (pth,fileName)
reader = OpenDataFile(inputFilename)
wrp = WarpByVector(reader)
wrp.ScaleFactor = 4e9
Show(wrp)
Render()
inputFilename = "%s/%s_outer.pvd" % (pth,fileName)
reader = OpenDataFile(inputFilename)
clp = Clip(reader)
clp.ClipType.Normal = [0, -1, 0]
clp.ClipType.Origin = [0, 0.0001, 0]
wrp2 = WarpByVector(clp)
wrp2.ScaleFactor = 4e9
Show(wrp2)
Render()
c = GetActiveCamera()
c.SetPosition(-17.87, 16.15, 19.31)
outputFilename = "%s/%s.avi" % (pth,fileName)
AnimateReader(reader, filename=outputFilename)
outputFilename = "%s/%s.png" % (pth,fileName)
WriteImage(outputFilename)
However, the scale factors for wrp and wrp2 are not updated, how do I fix this? (I tried wrp.UpdatePipeline())
Also, how do switch on one of the scalar fields? And how do I change the frame rate?
|