Exporting Result or Probe Animations

You can use the method ExportAnimation to export a result or probe animation to a video format (MP4, WMV, AVI, or GIF). This method supports no GUI mode in Workbench.

When exporting an animation to a video file, you can set the file name, format, and export settings.

  • GraphicsAnimationExportFormat sets the file format to which to save the animation.

  • AnimationExportSettings sets the width and height properties for the file. When this is not set, the resolution for the current graphics display is used to set the width and height.

Example 1

This code exports a result animation to a MP4 video file:

#Exporting a result animation to mp4 video file
totalDeform = DataModel.GetObjectsByName("Total Deformation")[0]
totalDeform.ExportAnimation("E:\\file.mp4",GraphicsAnimationExportFormat.MP4)

Example 2

This code exports a result animation to a WMV file with a specific resolution (width=1000,height=665):

#Exporting a result animation to wmv video file with given size
totalDeform1 = DataModel.GetObjectsByName("Total Deformation 1")[0]
settings = Ansys.Mechanical.Graphics.AnimationExportSettings(width = 1000, height = 665)
totalDeform1.ExportAnimation("E:\\file.wmv",GraphicsAnimationExportFormat.WMV,settings)

Animation Settings

To control the behavior of the animation for all results, you can specify global animation settings related to the toolbar visible when the Animation feature is used:

PropertyDescription
Graphics.ResultAnimationOptions.NumberOfFramesGets or sets the number of frames for the distributed result animation range type.
Graphics.ResultAnimationOptions.DurationGets or sets the range type of the result animation.
Graphics.ResultAnimationOptions.TimeDecayCyclesGets or sets the number of cycles for the time decay analysis.
Graphics.ResultAnimationOptions.UpdateContourRangeAtEachFrame Gets or sets if the legend contours update at each frame.
Graphics.ResultAnimationOptions.FitDeformationScalingToAnimationGets or sets the fit deformation scaling at each range for the full range for a result that has multiple time steps.

This code sets the number of frames to 200:

#set the number of frames to 200
Graphics.ResultAnimationOptions.NumberOfFrames = 200

This code sets the play duration to 12 seconds:

#set play duration to 12 seconds
Graphics.ResultAnimationOptions.Duration = Quantity(12, "s")