[Paraview] Visibility Animation using Python Batches
Maxime Taquet
maxime.taquet at uclouvain.be
Thu Apr 15 21:58:24 EDT 2010
Dear all,
Sorry if this question sounds dummy but I'm really new to Paraview and Python. I would like to realize and save an animation that displays tens of sphere sequentially (i.e. the spheres appear one at a time). Since I have a lot of them, I would like to do it using Python commands. However, it does not seem to work at all for me. Here is what I tried:
scene = servermanager.animation.AnimationScene()
scene.ViewModules = [GetActiveView()]
pts = [[15,15,15],[10,10,10],[5,5,5],[0,0,0],[-5,-5,-5],[-10,-10,-10],[-15,-15,-15]]
spheres=[]
cues=[]
ts=1
for i in range(len(pts)):
# Create the sphere
spheres.append(Sphere(Center=pts[i], Radius=2,ThetaResolution=5))
Show(spheres[i])
r = GetRepresentation()
r.DiffuseColor=[0.5,0.8,0]
# Animate
cues.append(servermanager.animation.KeyFrameAnimationCue())
cues[i].AnimatedProxy = GetActiveSource()
cues[i].AnimatedPropertyName = "Visibility"
keyf0 = servermanager.animation.CompositeKeyFrame()
keyf0.KeyTime = 0
keyf0.KeyValues=0
keyf1 = servermanager.animation.CompositeKeyFrame()
keyf1.KeyTime=i*ts
keyf1.KeyValues=1
cues[i].KeyFrames=[keyf0,keyf1]
scene.Cues = cues
scene.Play()
and I get this error:
ERROR: In /Users/partyd/Dashboards/MyTests/ParaView-3-8-0/ParaView3/Servers/ServerManager/vtkSMBooleanKeyFrameProxy.cxx, line 48
vtkSMBooleanKeyFrameProxy (0x143059ee0): Cue does not have domain or property set!
If there's a simple GUI way to do it, I'd be blessed too of course but I don't want to do it for each point separately. In the example, above, I just set pts to some arbitrary values but in my case I really have tens of points.
Thank you a lot in advance!
Maxime
More information about the ParaView
mailing list