Skip to main content

Motion Standalone Postprocessor C# library 2026 R1

Interface IOperationsAnimation

Last update: 09.03.2026

Namespace: VM.Operations.Post.Interfaces
Assembly: VM.Operations.Post.dll

Interface for Animation View.

public interface IOperationsAnimation : IView

Implements

IView

Examples

For an example that includes information about interfaces, see this example. To view the examples, refer to the location of the 'Install_Path\Motion\Document\Postprocessor API for Python.zip' file.

# IOperationsAnimation.py
import sys

# Get the current file's path and set the path for external modules.
current_dir = __file__.rsplit('\\', 1)[0]
external_modules_path = current_dir + '\\..\\..\\Modules'
sys.path.append(external_modules_path)

# Import necessary modules
from OperationAPI import *

# Start the headless application interface
applicationHandler = ApplicationHandler()

# Import result file
result_file_path = get_result_file_path()

# Set array about result file
filepaths = List[str]()
filepaths.Add(result_file_path)

# Open about result files
# This will open the result file in the application.
# When the result is first opened, a Page is created and an Animation View is created on that Page.
applicationHandler.AddDocument(filepaths)

# Get all created pages.
# This retrieves all pages created in the application.
pages = applicationHandler.GetPages()

findViews = list()
for page in pages :
    views = page.GetViews()
    animationViews = [view for view in views if view.ViewType == ViewType.Animation]
    for animationView in animationViews :
        if animationView.DocumentFilePath == result_file_path and animationView.AnalysisResultType == AnalysisResultType.Dynamics :
            findViews.append(animationView)

viewCount = len(findViews)
if viewCount > 0 :
    animationview = findViews[0]
    
    animationView.BottomColor = Colors.Red
    animationView.TopColor = Colors.Gray
    animationView.IsVisibleLogo = True
    animationView.IsVisibleNavigationCube = False
    animationView.IsVisibleStateInfo = False
    animationView.LogoHeight = 32
    animationView.LogoWidth = 32
    animationView.LogoPath = ""
    animationView.LogoPosition = Layout.BOTTOM_LEFT
    animationView.Opacity = 100
    animationView.StateInfoPosition = Layout.BOTTOM_LEFT
    animationView.TextColorStateInfo = Colors.Blue

    # Creating a CoordinateSystem
    # Name - Set the name of the instance.
    # ParentInfo - Specifies The path of an parent entity.
    animationview.CreateCoordinateSystem("Microphone", "Ground")

    # Get instance of entity
    # The GetViewModelByName method retrieves the target by its name.
    microphone = animationview.GetViewModelByName("Microphone")
    microphone.TransformationOffsetPosition = Vector(0,300,0)

    # Get instance of entity
    # The GetViewModelByName method retrieves the target by its name.
    febody = animationview.GetViewModelByName("FEBody_01")

    bodynames = List[str](1)
    bodynames.Add(febody.FullName)
    microphoneNames = List[str](1)
    microphoneNames.Add(microphone.FullName)

    # Creating a SoundPressure
    animationview.CreateSoundPressure(bodynames, microphoneNames, 10.0, 100.0, 3.0, 1.21E-09, 343000.0, 2000.0, 1, 10, False)

    # result_file_path - Get the document from the result file path.
    document = applicationHandler.GetDocument(result_file_path)

    # This retrieves the analysis result from the document.
    # Types of Analysis Results
    # - Dynamics
    # - Eigenvalue
    # - Statics
    dynamic_analysis = document.GetAnalysisResultViewModel(AnalysisResultType.Dynamics)
    dynamic_analysis.SetAnimationFrame(11)

    # Hides all entities except the specified ones.
    animationview.HideOthers(febody.FullName)

    # Fit the view to the current selection.
    animationview.Fit()

    # Show all entities in the view.
    animationView.ShowAll()

    # Following Camera
    # Translation
    animationview.Activate()
    animationview.IsFollowingCameraActive = True
    animationview.IsFollowingXAxis = True
    animationview.IsFollowingYAxis = False
    animationview.IsFollowingZAxis = False

    # Target Entity - Rigid(Body)
    animationview.SetFollowingCameraTarget("Crank")    

    # The output path is 'examples/Output'.
    output_dir = get_output_directory()

    # Following Camera - Recording Animation
    recording_path = combine_path(output_dir, r'AnimationRecording_Translation_Body')
    animationview.RecordingAnimation(recording_path, RecordingType.MP4, RecordingRangeType.ActiveGroup, 10)

    # Target Entity - Microphone(Coordinate System)
    animationview.SetFollowingCameraTarget("Microphone")

    # Following Camera - Recording Animation
    recording_path = combine_path(output_dir, r'AnimationRecording_Translation_Microphone')
    animationview.RecordingAnimation(recording_path, RecordingType.MP4, RecordingRangeType.ActiveGroup, 10)

    # Target Entity - Rigid/CM(Result Marker)
    animationview.SetFollowingCameraTarget("Crank/CM")

    # Following Camera - Recording Animation
    recording_path = combine_path(output_dir, r'AnimationRecording_Translation_CenterMarker')
    animationview.RecordingAnimation(recording_path, RecordingType.MP4, RecordingRangeType.ActiveGroup, 10)

    # Following Camera - Rotation
    animationView.TransformationType = TransformationType.Rotation
    animationview.IsFollowingRotXAxis = True
    animationview.IsFollowingRotYAxis = False
    animationview.IsFollowingRotZAxis = False

    # Target Entity - FEBody_01/Node/487(Node)
    animationview.SetFollowingCameraTarget("FEBody_01/Node/487")

    # Following Camera Recording Animation
    recording_path = combine_path(output_dir, r'AnimationRecording_Rotation')
    animationview.RecordingAnimation(recording_path, RecordingType.MP4, RecordingRangeType.ActiveGroup, 10)

    # Recording Animation
    viewSpecs = animationview.GetViewSpecs()

    recording_path = combine_path(output_dir, r'AnimationRecording')
    animationview.RecordingAnimation(recording_path, RecordingType.MP4, RecordingRangeType.ActiveGroup, 10, viewSpecs)

    # Move to Camera
    viewSpec = ViewSpec()
    viewSpec.Eye = Vector(10,20,30)
    viewSpec.Target = Vector(5, 10, 15)
    viewSpec.UpVector = Vector(1, 0, 0)
    
    animationview.SetViewSpec(viewSpec)

# Get all created pages.
# This retrieves all pages created in the application.
pages = applicationHandler.GetPages()
for page in pages :
    page.Close()

# Close Document
applicationHandler.CloseDocument(result_file_path)

Remarks

This interface provides functionalities for managing and interacting with animation views. It includes properties and methods to control the appearance, behavior, and data associated with animation views.

Properties

AnalysisResultType

Gets the type of analysis result for the currently created animation view.

AnalysisResultType AnalysisResultType { get; }

Property Value

AnalysisResultType

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

The AnalysisResultType property is used to determine the type of analysis result associated with the currently created animation view.This type is one of several analysis types generated from the overall result. The available options are:

BottomColor

Gets or sets the bottom color of the view's background.

Color BottomColor { get; set; }

Property Value

Color

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

The property allows you to set the bottom color of the view's background. In the UI, this property is represented under the "Background" category with the property name "Bottom Color".

DocumentFilePath

Gets the file path that contains the information of the simulation results.

string DocumentFilePath { get; }

Property Value

string

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

Use this property to retrieve the location of the file containing the simulation results. The file path is read-only and is determined by the simulation process.

IsFollowingCameraActive

Gets or sets a value that activates the following camera.

bool IsFollowingCameraActive { get; set; }

Property Value

bool

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This property enables or disables the camera's tracking behavior. When set to true, the camera's viewpoint will follow the position and orientation of the target body during animation. If set to false, the camera will remain stationary and will not track the target.

IsFollowingRotXAxis

Gets or sets a value that determines whether the component follows the orientation of the target along the X-axis.

bool IsFollowingRotXAxis { get; set; }

Property Value

bool

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This property controls whether the component tracks the target's orientation on the X-axis. When set to true, the component will adjust its orientation to match the target's X-axis rotation. When set to false, the component will not follow the X-axis rotation of the target.

IsFollowingRotYAxis

Gets or sets a value that determines whether the component follows the orientation of the target along the Y-axis.

bool IsFollowingRotYAxis { get; set; }

Property Value

bool

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This property controls whether the component tracks the target's orientation on the Y-axis. When set to true, the component will adjust its orientation to match the target's Y-axis rotation. When set to false, the component will not follow the Y-axis rotation of the target.

IsFollowingRotZAxis

Gets or sets a value that determines whether the component follows the orientation of the target along the Z-axis.

bool IsFollowingRotZAxis { get; set; }

Property Value

bool

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This property controls whether the component tracks the target's orientation on the Z-axis. When set to true, the component will adjust its orientation to match the target's Z-axis rotation. When set to false, the component will not follow the Z-axis rotation of the target.

IsFollowingXAxis

Gets or sets a value that determines whether the component follows the position of the target along the X-axis.

bool IsFollowingXAxis { get; set; }

Property Value

bool

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This property controls whether the component tracks the target's position specifically on the X-axis. When set to true, the component will move to match the target's X position. When set to false, the component will not follow the X position of the target.

IsFollowingYAxis

Gets or sets a value that determines whether the component follows the position of the target along the Y-axis.

bool IsFollowingYAxis { get; set; }

Property Value

bool

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This property controls whether the component tracks the target's position specifically on the Y-axis. When set to true, the component will move to match the target's Y position. When set to false, the component will not follow the Y position of the target.

IsFollowingZAxis

Gets or sets a value that determines whether the component follows the position of the target along the Z-axis.

bool IsFollowingZAxis { get; set; }

Property Value

bool

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This property controls whether the component tracks the target's position specifically on the Z-axis. When set to true, the component will move to match the target's Z position. When set to false, the component will not follow the Z position of the target.

Gets or sets a value indicating whether the logo is visible.

bool IsVisibleLogo { get; set; }

Property Value

bool

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This flag determines whether the logo is shown or hidden. In the UI, this property is represented under the "Logo" category with the property name "Visible".

IsVisibleNavigationCube

Gets or sets a value indicating whether the navigation cube is visible.

bool IsVisibleNavigationCube { get; set; }

Property Value

bool

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This flag determines whether the navigation cube is shown or hidden. In the UI, this property is represented under the "Navigation Cube" category with the property name "Visible".

IsVisibleStateInfo

Gets or sets a value indicating whether the state information is visible.

bool IsVisibleStateInfo { get; set; }

Property Value

bool

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This flag determines whether the state information is shown or hidden. In the UI, this property is represented under the "StateInfo" category with the property name "Visible".

LogoHeight

Gets or sets the height of the logo image.

uint LogoHeight { get; set; }

Property Value

uint

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This property allows you to set the height of the logo image. In the UI, this property is represented under the "Logo" category with the property name "Height".

LogoPath

Gets or sets the file path of the logo image.

string LogoPath { get; set; }

Property Value

string

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This property allows you to set the file path of the logo image. In the UI, this property is represented under the "Logo" category with the property name "File Path".

LogoPosition

Gets or sets the position of the logo.

Layout LogoPosition { get; set; }

Property Value

Layout

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This property allows you to set the position of the logo. The available options are:

In the UI, this property is represented under the "Logo" category with the property name "Layout".

LogoWidth

Gets or sets the width of the logo image.

uint LogoWidth { get; set; }

Property Value

uint

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This property allows you to set the width of the logo image. In the UI, this property is represented under the "Logo" category with the property name "Width".

Gets or sets the position of the navigation cube.

Layout NavigationCubePosition { get; set; }

Property Value

Layout

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This property allows you to set the position of the navigation cube. The available options are:

In the UI, this property is represented under the "Navigation Cube" category with the property name "Layout".

Opacity

Gets or sets the opacity of the logo.

double Opacity { get; set; }

Property Value

double

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This property allows you to set the opacity of the logo. Only values between 0 and 100 are valid. In the UI, this property is represented under the "Logo" category with the property name "Transparency".

StateInfoPosition

Gets or sets the position of the state information.

Layout StateInfoPosition { get; set; }

Property Value

Layout

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This property allows you to set the position of the state information. The available options are:

In the UI, this property is represented under the "StateInfo" category with the property name "Layout".

TextColorStateInfo

Gets or sets the font color of the state information.

Color TextColorStateInfo { get; set; }

Property Value

Color

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This property allows you to set the font color of the state information. In the UI, this property is represented under the "StateInfo" category with the property name "Font Color".

TopColor

Gets or sets the top color of the view's background.

Color TopColor { get; set; }

Property Value

Color

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

The property allows you to set the top color of the view's background. In the UI, this property is represented under the "Background" category with the property name "Top Color".

TransformationType

Gets or sets the transformation type that determines the following directions of the camera.

TransformationType TransformationType { get; set; }

Property Value

TransformationType

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

The property is used to control whether the camera follows the target's translational or rotational direction.

  • In Translation mode, the camera follows only the movement of the target and does not adjust to its rotation.
  • In Rotation mode, the camera follows the target's rotation but also tracks its translational direction.

Methods

CreateCoordinateSystem(string, string)

Creates a coordinate system for analyzing a position on a body.

IOperationsCSYSViewModel CreateCoordinateSystem(string name, string parentInfo = "Ground")

Parameters

name string

The name of the coordinate system to be created.

parentInfo string

The parent entity for the coordinate system. Define the parent body or node in coordinate system. If not provided, the default value is .

Returns

IOperationsCSYSViewModel

An instance of representing the created coordinate system.

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This method creates a coordinate system with the specified name and assigns it to the given parent entity. If the parent entity is not specified, the coordinate system is assigned to the default ground entity.

CreateSoundPressure(IList<string>, IList<string>, double, double, double, double, double, double, int, int, bool)

Creates sound pressure data based on the Rayleigh Integral for analyzing sound pressure generated by vibrations on the system surface.

IEnumerable<IOperationsLineDataSeriesViewModelBase> CreateSoundPressure(IList<string> bodyNames, IList<string> coordinateNames, double coarseningRate, double maxAreaFactor, double maxAspectRatio, double airDensity, double soundVelocity, double frequency, int start, int end, bool isDeicbelScale)

Parameters

bodyNames IList<string>

The list of entity names whose surfaces generate the sound pressure.

coordinateNames IList<string>

The list of coordinate system names used in the analysis.

coarseningRate double

Percentage of the number of nodes remaining in the sampling result with respect to the initial number of nodes.

maxAreaFactor double

Maximum allowable area of each element generated by the sampling result. It sets the condition that the area of each element cannot be greater than (Max Area Factor) * (Average element area).

maxAspectRatio double

Maximum allowable aspect ratio of each element generated by the sampling result.

airDensity double

Density of the air.

soundVelocity double

Speed of sound in air.

frequency double

The number of analysis results per second is determined as 10*analysis frequency.

start int

The start frame for the time range to be analyzed.

end int

The end frame for the time range to be analyzed.

isDeicbelScale bool

The decibel scale.

Returns

IEnumerable<IOperationsLineDataSeriesViewModelBase>

A collection of sound pressure data series.

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This method uses the Rayleigh Integral to analyze the sound pressure generated by the vibrations on the system surface.

Fit()

Adjusts the view to fit all visible entities within the current viewport.

void Fit()

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

The method ensures that all visible entities are scaled and positioned to fit within the current viewport. This is useful for resetting the view to include all entities after zooming or panning.

GetViewModelByName(string)

Retrieves an instance of an entity based on the provided name.

IEntityBaseViewModel GetViewModelByName(string name)

Parameters

name string

The name of the entity to be retrieved.

Returns

IEntityBaseViewModel

An instance of representing the entity with the specified name, or null if no such entity exists.

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This method searches for an entity with the given name and returns the corresponding instance. If no entity with the specified name is found, the method returns null.

GetViewSpecs()

Retrieves an array of view specifications corresponding to the number of loaded animation frames.

IViewSpec[] GetViewSpecs()

Returns

IViewSpec[]

An array of instances that represent the positions of the animation camera for each frame, or null if no frames are loaded.

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This method returns an array where each element corresponds to a specific frame in the loaded animation, allowing for the configuration of the animation camera's position for each frame. If no frames are loaded, the method returns null.

HideOthers(params string[])

Hides all entities except the specified ones.

void HideOthers(params string[] names)

Parameters

names string[]

An array of entity names to remain visible. All other entities will be hidden.

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

The method is used to hide all entities in the current view except for those specified in the names parameter. This is useful for focusing on specific entities while temporarily hiding others.

HideOthers(params Guid[])

Hides all entities except the specified ones.

void HideOthers(params Guid[] entityIDs)

Parameters

entityIDs Guid[]

An array of entity ids to remain visible. All other entities will be hidden.

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

The method is used to hide all entities in the current view except for those specified in the entityIDs parameter. This is useful for focusing on specific entities while temporarily hiding others.

PlayAnimation()

Plays the loaded animation frames.

void PlayAnimation()

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This method starts the playback of the animation frames that have been loaded. If no frames are loaded, the method should handle this scenario appropriately, such as by displaying an error message or logging the issue.

RecordingAnimation(string, RecordingType, RecordingRangeType, int, IViewSpec[])

Records the loaded animation frames to a file.

void RecordingAnimation(string filePath, RecordingType recordingType, RecordingRangeType rangeType, int frameRate = 10, IViewSpec[] viewSpecs = null)

Parameters

filePath string

The file path where the recording will be saved.

recordingType RecordingType

The format in which the recording will be saved. Supported types are AVI, WMV1, WMV2, MP4, and GIF.

rangeType RecordingRangeType

The range of the recording. Supported options are for the currently active view, and for the page containing the active view.

frameRate int

The frame rate of the recording. The default value is 10 frames per second.

viewSpecs IViewSpec[]

An array of instances for setting the camera position for each frame. If null, the camera position will not change and will remain at the existing position.

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This method records the loaded animation frames to a specified file format. It supports different recording types and range options. The frame rate can be adjusted, and custom camera positions for each frame can be set through the viewSpecs parameter.

SetFollowingCameraTarget(string)

Sets the target body for the camera. The camera's position and orientation will follow those of the target body.

void SetFollowingCameraTarget(string targetName)

Parameters

targetName string

The names of the target entity. The target entities are Body, Marker, Node.

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This function allows the camera to track and maintain the same position and orientation as the target body. It is useful for situations where the camera needs to follow an object, such as in a third-person perspective or object tracking scenario. If the target body is a ResultMarker and its IsVisible property is false, it will automatically be set to true to ensure visibility when being tracked by the camera.

SetViewSpec(IViewSpec)

Updates the camera information for the current animation frame position.

void SetViewSpec(IViewSpec viewSpec)

Parameters

viewSpec IViewSpec

The instance containing the new camera information.

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This method updates the camera information for the current position in the animation frames using the provided viewSpec.

ShowAll()

Makes all entities visible in the current view.

void ShowAll()

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

The method is used to make all entities in the current view visible. This is useful for resetting the view to display all entities after some have been hidden.

StopAnimation()

Stops the currently playing animation.

void StopAnimation()

Examples

For an example that includes this property, see the Interface IOperationsAnimation.

Remarks

This method stops the playback of the animation frames that are currently playing. If no animation is currently playing, the method should handle this scenario appropriately, such as by displaying an error message or logging the issue.

Connect with Ansys