# trace generated using paraview version 5.12.1
#import paraview
#paraview.compatibility.major = 5
#paraview.compatibility.minor = 12

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# create a new 'IOSS Reader'
d_Fe = IOSSReader(registrationName='d_F.e', FileName=['/Users/torres/Documents/exodusfiles/1D/d_F.e'])

# get animation scene
animationScene1 = GetAnimationScene()

# update animation scene based on data timesteps
animationScene1.UpdateAnimationUsingDataTimeSteps()

# get active view
renderView1 = GetActiveViewOrCreate('RenderView')

# show data in view
d_FeDisplay = Show(d_Fe, renderView1, 'UnstructuredGridRepresentation')

# trace defaults for the display properties.
d_FeDisplay.Representation = 'Surface'

# reset view to fit data
renderView1.ResetCamera(False, 0.9)

# get the material library
materialLibrary1 = GetMaterialLibrary()

# update the view to ensure updated data information
renderView1.Update()

 # get animation representation helper for 'd_Fe'
d_FeRepresentationAnimationHelper = GetRepresentationAnimationHelper(d_Fe)

# get animation track
d_FeRepresentationAnimationHelperVisibilityTrack = GetAnimationTrack('Visibility', index=0, proxy=d_FeRepresentationAnimationHelper)

# create a new key frame
keyFrame10924 = CompositeKeyFrame()

# create a new key frame
keyFrame10925 = CompositeKeyFrame()
keyFrame10925.KeyTime = 1.0

# initialize the animation track
d_FeRepresentationAnimationHelperVisibilityTrack.KeyFrames = [keyFrame10924, keyFrame10925]

# create a new key frame
keyFrame10929 = CompositeKeyFrame()

# Properties modified on keyFrame10929
keyFrame10929.Interpolation = 'Boolean'

# Properties modified on keyFrame10924
keyFrame10924.Interpolation = 'Boolean'

# Properties modified on keyFrame10925
keyFrame10925.KeyValues = [1.0]

# Properties modified on d_FeRepresentationAnimationHelperVisibilityTrack
d_FeRepresentationAnimationHelperVisibilityTrack.KeyFrames = [keyFrame10929, keyFrame10924, keyFrame10925]

# Properties modified on d_FeRepresentationAnimationHelper
d_FeRepresentationAnimationHelper.Visibility = 0

#================================================================
# addendum: following script captures some of the application
# state to faithfully reproduce the visualization during playback
#================================================================

# get layout
layout1 = GetLayout()

#--------------------------------
# saving layout sizes for layouts

# layout/tab size in pixels
layout1.SetSize(2152, 774)

#-----------------------------------
# saving camera placements for views

# current camera placement for renderView1
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.51475, 1.9888412763291918, 0.0]
renderView1.CameraFocalPoint = [0.51475, 0.0, 0.0]
renderView1.CameraViewUp = [1.0, 0.0, 0.0]
renderView1.CameraParallelScale = 0.51475


##--------------------------------------------
## You may need to add some code at the end of this python script depending on your usage, eg:
#
## Render all views to see them appears
# RenderAllViews()
#
## Interact with the view, usefull when running from pvpython
# Interact()
#
## Save a screenshot of the active view
# SaveScreenshot("path/to/screenshot.png")
#
## Save a screenshot of a layout (multiple splitted view)
# SaveScreenshot("path/to/screenshot.png", GetLayout())
#
## Save all "Extractors" from the pipeline browser
# SaveExtracts()
#
## Save a animation of the current active view
# SaveAnimation()
#
## Please refer to the documentation of paraview.simple
## https://kitware.github.io/paraview-docs/latest/python/paraview.simple.html
##--------------------------------------------