Class OperationAPIService
Last update: 09.03.2026Namespace: VM.API.Post.Operations
Assembly: VM.API.Post.Operations.dll
A utility class that provides methods to convert string values to specific types.
public static class OperationAPIService
Inheritance
object ← OperationAPIService
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.
# OperationAPIService.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.Legend.Background = OperationAPIService.GetColorFromHexCode("#FF000000")
chartView.Legend.FontColor = OperationAPIService.GetColorFrameRGB(255,255,255)
chartView.Legend.FontFace = OperationAPIService.GetFontFaceFromString("Arial")
chartView.Legend.FontStyle = OperationAPIService.GetFontStyleFromString("Italic")
chartView.Legend.FontWeight = OperationAPIService.GetFontWeightFromString("Bold")
# Get all created pages.
# This retrieves all pages created in the application.
pages = applicationHandler.GetPages()
for page in pages :
page.Close()
# Close the Document
applicationHandler.CloseDocument(result_file_path)
Methods
GetColorFrameRGB(int, int, int)
Converts the specified RGB values into a
public static Color GetColorFrameRGB(int r, int g, int b)
Parameters
r int
The red component of the color, ranging from 0 to 255.
g int
The green component of the color, ranging from 0 to 255.
b int
The blue component of the color, ranging from 0 to 255.
Returns
Color
A
Examples
For an example that includes this property, see the OperationAPIService.
Remarks
This method takes integer values for the red, green, and blue components and converts them into a
GetColorFromHexCode(string)
Converts a hex color code to a
public static Color GetColorFromHexCode(string color)
Parameters
color string
The hex color code string to be converted.
Returns
Color
A
Examples
For an example that includes this property, see the OperationAPIService.
Remarks
This method converts a hex color code (e.g., "#FF5733") to a
GetFontFaceFromString(string)
Converts a font face string to a
public static FontFamily GetFontFaceFromString(string fontface)
Parameters
fontface string
The font face string to be converted.
Returns
FontFamily
A
Examples
For an example that includes this property, see the OperationAPIService.
Remarks
This method converts a font face string (e.g., "Arial") to a
GetFontStyleFromString(string)
Converts a font style string to a
public static FontStyle GetFontStyleFromString(string fontstyle)
Parameters
fontstyle string
The font style string to be converted (e.g., "Normal", "Italic", "Oblique").
Returns
FontStyle
A
Examples
For an example that includes this property, see the OperationAPIService.
Remarks
This method converts a font style string (e.g., "Normal", "Italic", "Oblique") to a
GetFontWeightFromString(string)
Converts a font weight string to a
public static FontWeight GetFontWeightFromString(string fontweight)
Parameters
fontweight string
The font weight string to be converted (e.g., "Normal", "Bold", "Thin").
Returns
FontWeight
A
Examples
For an example that includes this property, see the OperationAPIService.
Remarks
This method converts a font weight string (e.g., "Normal", "Bold", "Thin") to a