I am trying to use the clipping tool with pvpython, but when I save animation, it doesn’t work. I am using the clip to reveal an image at specific times. It works perfectly fine when I run the python script in paraview but for some reason it doesn’t animate the clip with pvpython.
I am using paraview version 5.5.0-RC3 for the trace and python script. I am trying to run it using pv python and paraview-5.6.0-gcc-7.3.0-irmhfar on the remote machine.
Here are the relevant parts of the script:
CLIPS OF WAVES
# create a new 'Clip'
clip1 = Clip(Input=WAVEPNG)
clip1.ClipType = 'Plane'
clip1.Scalars = [None, '']
#hide unclipped wave
Hide(WAVEPNG, renderView1)
# init the 'Plane' selected for 'ClipType'
clip1.ClipType.Origin = [float(a[j-1][7]), 0.0, 0.0]
#clip1.ClipType.Origin = [float(0.0, 0.0, 0.0]
# Properties modified on clip1
clip1.Scalars = ['POINTS', '']
# show data in view
clip1Display = Show(clip1, renderView1)
# trace defaults for the display properties.
clip1Display.Representation = 'Surface'
clip1Display.ColorArrayName = ['POINTS', 'PNGImage']
clip1Display.LookupTable = pNGImageLUT
clip1Display.OSPRayScaleArray = 'PNGImage'
clip1Display.OSPRayScaleFunction = 'PiecewiseFunction'
clip1Display.SelectOrientationVectors = 'None'
clip1Display.ScaleFactor = 46.1
clip1Display.SelectScaleArray = 'PNGImage'
clip1Display.GlyphType = 'Arrow'
clip1Display.GlyphTableIndexArray = 'PNGImage'
clip1Display.GaussianRadius = 2.305
clip1Display.SetScaleArray = ['POINTS', 'PNGImage']
clip1Display.ScaleTransferFunction = 'PiecewiseFunction'
clip1Display.OpacityArray = ['POINTS', 'PNGImage']
clip1Display.OpacityTransferFunction = 'PiecewiseFunction'
clip1Display.DataAxesGrid = 'GridAxesRepresentation'
clip1Display.SelectionCellLabelFontFile = ''
clip1Display.SelectionPointLabelFontFile = ''
clip1Display.PolarAxes = 'PolarAxesRepresentation'
clip1Display.ScalarOpacityFunction = pNGImagePWF
clip1Display.ScalarOpacityUnitDistance = 10.655043253921903
# init the 'PiecewiseFunction' selected for 'ScaleTransferFunction'
clip1Display.ScaleTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 255.0, 1.0, 0.5, 0.0]
# init the 'PiecewiseFunction' selected for 'OpacityTransferFunction'
clip1Display.OpacityTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 255.0, 1.0, 0.5, 0.0]
# init the 'GridAxesRepresentation' selected for 'DataAxesGrid'
clip1Display.DataAxesGrid.XTitleFontFile = ''
clip1Display.DataAxesGrid.YTitleFontFile = ''
clip1Display.DataAxesGrid.ZTitleFontFile = ''
clip1Display.DataAxesGrid.XLabelFontFile = ''
clip1Display.DataAxesGrid.YLabelFontFile = ''
clip1Display.DataAxesGrid.ZLabelFontFile = ''
# init the 'PolarAxesRepresentation' selected for 'PolarAxes'
clip1Display.PolarAxes.PolarAxisTitleFontFile = ''
clip1Display.PolarAxes.PolarAxisLabelFontFile = ''
clip1Display.PolarAxes.LastRadialAxisTextFontFile = ''
clip1Display.PolarAxes.SecondaryRadialAxesTextFontFile = ''
# show color bar/color legend
clip1Display.SetScalarBarVisibility(renderView1, False)
# update the view to ensure updated data information
renderView1.Update()
# hide color bar/color legend
clip1Display.SetScalarBarVisibility(renderView1, False)
# Properties modified on clip1Display
clip1Display.MapScalars = 0
# get animation scene
animationScene1 = GetAnimationScene()
# get animation track
# clip1ClipTypeOriginTrack = GetAnimationTrack('Origin', 0, proxy=clip1.ClipType)
clip1ClipTypeOriginTrack = GetAnimationTrack('Origin', 0, proxy=clip1.ClipType)
# create keyframes for this animation track
# create a key frame
keyframe1 = CompositeKeyFrame()
keyframe1.Interpolation = 'Ramp'
#keyframe1.KeyTime = [-.62] #start time of clip in sec.
keyframe1.KeyTime = [0] #by default, when this is set to zero it the start time of clip.
keyframe1.KeyValues = [0] # starting pt. of clip, these values vary so I do it manually sometimes.
renderView1.Update()
# create a key frame
keyframe2 = CompositeKeyFrame()
keyframe2.Interpolation = 'Ramp'
#keyframe2.KeyTime = [0.0] ##by default, when this is set to zero it the end time of clip.
keyframe2.KeyTime = [1]
keyframe2.KeyValues = [float(a[j-1][7])] #ending pt. of clip these values vary so I do it manually sometimes.
renderView1.Update()
# initialize the animation track
clip1ClipTypeOriginTrack.KeyFrames = [keyframe1, keyframe2]
# get display properties
clip1Display = GetDisplayProperties(clip1, view=renderView1)
# Properties modified on clip1Display
clip1Display.Position = R[j-1][0]-200,(R[j-1][1])+850,R[j-1][2] #Was -400 [300.0, 1800.0, 0.0] , coords. found by code on top page.
# Properties modified on clip1Display.DataAxesGrid
clip1Display.DataAxesGrid.Position =R[j-1][0]-200,(R[j-1][1])+850,R[j-1][2] # [300.0, 1800.0, 0.0], coords. found by code on top page.
# Properties modified on clip1Display.PolarAxes
clip1Display.PolarAxes.Translation = R[j-1][0]-200,(R[j-1][1])+850,R[j-1][2] #[300.0, 1800.0, 0.0], coords. found by code on top page.
# Properties modified on clip1Display
clip1Display.Orientation = [180.0, 0.0, 0.0]
# Properties modified on clip1Display.PolarAxes
clip1Display.PolarAxes.Orientation = [180.0, 0.0, 0.0]
renderView1.Update()
…code…
############## View Animation #######################
# get animation scene
#animationScene1 = GetAnimationScene()
# Properties modified on animationScene1
animationScene1.PlayMode = 'Sequence'
#animationScene1.StartTime = -float(max(A_MAX_shift))
animationScene1.StartTime = -.62
# Properties modified on animationScene1
animationScene1.EndTime = 0.0
# Properties modified on animationScene1
#animationScene1.NumberOfFrames = 2000
animationScene1.NumberOfFrames = 1300
##Background####
# Properties modified on renderView1
#renderView1.UseTexturedBackground = 1
renderView1.Background = [0, 0, 0]
####renderView1.UseTexturedBackground = 1
# update the view to ensure updated data information
renderView1.Update()
SaveAnimation('path/to/images/AB.png', renderView1, ImageResolution=[1920, 1080],FrameRate=60,FrameWindow=[0, 1300]) #FrameWindow=[0, 1300]