Skip to main content

Motion Standalone Postprocessor C# library 2026 R1

Interface IOperationsLine2DViewModelBase

Last update: 09.03.2026

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

Represents the base interface for properties and methods that make up a 2D chart view.

public interface IOperationsLine2DViewModelBase : IOperationsChartViewModel, IView

Implements

IOperationsChartViewModel, IView

Examples

To view the examples, refer to the location of the 'Install_Path\Motion\Document\Postprocessor API for Python.zip' file.

# IOperationsLine2DViewModelBase.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 Active Page
# This retrieves the currently active page in the application.
page = applicationHandler.GetActivePage()

# Creating a Chart
# Create a new Chart View on the page
# This will create a new chart view with the specified name.
chartView = page.CreateChart("Chart")
chartView.Background = Colors.Gray
chartView.BorderColor = Colors.Red
chartView.FontColor = Colors.White
chartView.ChartTitle = "Chart"
chartView.ChartAxisType = ChartAxisType.Single
chartView.FontFace = FontFamily("Arial")
chartView.FontSize = 16
chartView.FontStyle = OperationAPIService.GetFontStyleFromString("Italic")
chartView.FontWeight = OperationAPIService.GetFontWeightFromString("Bold")

# Documentation Example
# Set array about combination of characteristic and component
curvePaths = List[str]()
curvePaths.Add(r'Displacement/Magnitude')
curvePaths.Add(r'Displacement/X')
curvePaths.Add(r'Displacement/Y')
curvePaths.Add(r'Displacement/Z')

# Create a PlotParameters object to specify the parameters for the plot.
# Set the Entity to Plot.
# The Target is the name of the target for which you want to retrieve the curves.
# Set the paths for the curves you want to retrieve.
# This is where you specify the characteristics and components you want to plot.
parameters = PlotParameters()
parameters.Paths = curvePaths
parameters.Target = "Crank"

# Add Curves (FilePath, Curve Parameter)
# FilePath - The path of the result to access.
# parameters - The class used as a parameter of the AddCurve function.
# The instance of the curve.
curves = chartView.AddCurves(result_file_path, parameters)

chartView.Remove(curves[3].ID)
chartView.Remove(curves[2])

curves[0].SeriesName = "Crank_Curve"

curveByName = chartView.GetCurve("Crank_Curve")
curveByName.SeriesName = "Crank_Displacement_Magnitude"

curveByID = chartView.GetCurveByID(curves[1].ID)
curveByID.SeriesName = "Crank_Displacement_X"

curvelist = chartView.GetCurves()

index = 0
for curve in curvelist:
    curve.SeriesName = "{0}({1})".format(curve.SeriesName, index)
    index = index + 1

curvelist = chartView.GetCurves("X")

index = 0
for curve in curvelist:
    curve.SeriesName = "{0}({1})".format(curve.SeriesName, index)
    index = index + 1

last_curve = chartView.GetLastCurve()
last_curve.SeriesName = "{0}_Last".format(last_curve.SeriesName)

name_list = chartView.GetCurveNameList()
name_array = list(name_list)

curveByName = chartView.GetCurve(name_array[0])
curveByName.SeriesName = "{0}_By_NameList".format(curveByName.SeriesName)

# Close the Pages
page.Close()

# Close the Document
applicationHandler.CloseDocument(result_file_path)

Properties

Background

Gets or sets the background color of the chart view.

Color Background { get; set; }

Property Value

Color

Examples

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

Remarks

This property allows you to set the background color of the chart view. In the UI, this property is represented under the "Color" category with the property name "Back Ground".

BorderColor

Gets or sets the border color of the chart view.

Color BorderColor { get; set; }

Property Value

Color

Examples

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

Remarks

This property allows you to set the border color of the chart view. In the UI, this property is represented under the "Color" category with the property name "Border Color".

ChartAxisType

Gets or sets the axis type of the chart, indicating whether to display the chart's axis as single or multiple.

ChartAxisType ChartAxisType { get; set; }

Property Value

ChartAxisType

Examples

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

Remarks

This property allows you to set the axis type of the chart. It indicates whether the chart's axis is displayed as single or multiple. In the UI, this property is represented under the "Axis" category with the property name "Axis Type". The available options are:

ChartTitle

Gets or sets the title of the chart view.

string ChartTitle { get; set; }

Property Value

string

Examples

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

Remarks

This property allows you to set the title of the chart view. In the UI, this property is represented under the "Chart" category with the property name "Title".

FontColor

Gets or sets the font color of the chart view's title.

Color FontColor { get; set; }

Property Value

Color

Examples

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

Remarks

This property allows you to set the font color of the chart view's title. In the UI, this property is represented under the "Chart" category with the property name "Font Color".

FontFace

Gets or sets the font face of the chart title.

FontFamily FontFace { get; set; }

Property Value

FontFamily

Examples

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

Remarks

This property allows you to set the font face of the chart title. In the UI, this property is represented under the "Font" category with the property name "Face".

FontSize

Gets or sets the font size of the chart title.

double FontSize { get; set; }

Property Value

double

Examples

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

Remarks

This property allows you to set the font size of the chart title. In the UI, this property is represented under the "Font" category with the property name "Size".

FontStyle

Gets or sets the font style of the chart title.

FontStyle FontStyle { get; set; }

Property Value

FontStyle

Examples

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

Remarks

This property allows you to set the font style of the chart title. In the UI, this property is represented under the "Font" category with the property name "Style". The supported types are:

FontWeight

Gets or sets the font weight of the chart title.

FontWeight FontWeight { get; set; }

Property Value

FontWeight

Examples

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

Remarks

This property allows you to set the font weight of the chart title. In the UI, this property is represented under the "Font" category with the property name "Weight". The available options are:

Methods

AddCurves(string, PlotParameters)

Adds curves to the chart by reading data from the specified file path and using the given plot parameters. Please refer to this here link.

IOperationsLineDataSeriesViewModelBase[] AddCurves(string filepath, PlotParameters parameters)

Parameters

filepath string

The path to the file containing the curve data.

parameters PlotParameters

The parameters used for plotting the curves, including target entity, data paths, coordinate system, and plot data type.

  • - The target entity for plotting the curves.
  • - Default or Plot Data.
  • - An Paths representing the paths to the data to be read. This is a combination of characteristic and component.
  • - The coordinate system to be used.

Returns

IOperationsLineDataSeriesViewModelBase[]

An array of representing the added curves.

Examples

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

Remarks

This method reads data from the specified file path and adds curves to the chart using the provided plot parameters.

ExportAllCurves(string)

Exports all curves contained in the chart to the specified file path without displaying a file save dialog.

void ExportAllCurves(string filepath)

Parameters

filepath string

The file path where the curves will be saved.

Examples

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

Remarks

This method exports all data series contained in the chart without displaying a file save dialog. It accepts a file path as a parameter and saves the curves directly to that location. This method is recommended for use with the OperationAPI, especially for repetitive tasks or scenarios requiring automation.

ExportAllDataSeries()

Exports all data series included in the chart.

void ExportAllDataSeries()

Examples

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

Remarks

This method exports all curves contained in the chart. When used via the OperationAPI, a file dialog appears on the screen to specify the file save location. Therefore, it is not recommended for repetitive tasks or scenarios requiring automation. Instead, it is recommended to use the method, which does not display a file save dialog.

GetAxis(string)

Retrieves an axis by its name.

IOperationsAxisViewModelBase GetAxis(string name)

Parameters

name string

The name of the axis to be retrieved.

Returns

IOperationsAxisViewModelBase

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

Examples

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

Remarks

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

GetCurve(string)

Gets a curve from the chart by its name.

IOperationsLineDataSeriesViewModelBase GetCurve(string name)

Parameters

name string

The name of the curve to retrieve.

Returns

IOperationsLineDataSeriesViewModelBase

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

Examples

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

Remarks

This method searches for and returns the curve with the given name from the chart. If no curve with the specified name is found, it returns null.

GetCurveByID(string)

Gets a curve from the chart by its ID.

IOperationsLineDataSeriesViewModelBase GetCurveByID(string id)

Parameters

id string

The ID of the curve to retrieve.

Returns

IOperationsLineDataSeriesViewModelBase

An instance of representing the curve with the specified ID, or null if no such curve exists.

Examples

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

Remarks

This method searches for and returns the curve with the given ID from the chart. If no curve with the specified ID is found, it returns null.

GetCurveNameList()

Gets a list of names of all curves in the chart view.

IEnumerable<string> GetCurveNameList()

Returns

IEnumerable<string>

A collection of the names of all curves currently displayed in the chart view.

Examples

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

Remarks

This method retrieves the names of all the curves that are currently displayed in the chart view.

GetCurves()

Gets all the curves currently included in the chart view.

IEnumerable<IOperationsLineDataSeriesViewModelBase> GetCurves()

Returns

IEnumerable<IOperationsLineDataSeriesViewModelBase>

A collection of all the curves currently displayed in the chart view.

Examples

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

Remarks

This method retrieves all the curves that are currently displayed in the chart view.

GetCurves(string)

Gets all curves from the chart view that contain the specified substring in their names.

IEnumerable<IOperationsLineDataSeriesViewModelBase> GetCurves(string name)

Parameters

name string

A substring to search for within the curve names.

Returns

IEnumerable<IOperationsLineDataSeriesViewModelBase>

A collection of all curves whose names contain the specified substring.

Examples

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

Remarks

This method searches for and returns all curves whose names contain the specified substring. If no such curves are found, an empty collection is returned.

GetLastCurve()

Gets the most recently added curve from the chart view.

IOperationsLineDataSeriesViewModelBase GetLastCurve()

Returns

IOperationsLineDataSeriesViewModelBase

An instance of representing the last added curve, or null if no curves are present.

Examples

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

Remarks

This method retrieves the curve that was added last to the chart view. If no curves have been added, it returns null.

Remove(string)

Removes a curve from the chart by its id.

void Remove(string id)

Parameters

id string

The id of the curve to be removed.

Examples

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

Remarks

This method deletes the curve with the specified id from the chart. If no curve with the given id exists, no action is taken.

Remove(IOperationsLineDataSeriesViewModelBase)

Removes a curve from the chart by its instance.

void Remove(IOperationsLineDataSeriesViewModelBase curve)

Parameters

curve IOperationsLineDataSeriesViewModelBase

The instance of the curve to be removed.

Examples

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

Remarks

This method deletes the specified curve instance from the chart. If the provided curve instance does not exist in the chart, no action is taken.

Connect with Ansys