Skip to main content

ZOS-API interface 2024 R1

ZOSAPI.IZOSAPI_Connection Interface Reference

Last update: 17.07.2025

This is the initial interface to Optic Studio. All applications that wish to use the ZOS-API must first establish a connection, using the T:ZOSAPI.ZOSAPI_Connection class. More...

Inheritance diagram for ZOSAPI.IZOSAPI_Connection:

Public Member Functions

IZOSAPI_Application ConnectToApplication ()
 Attempts to connect to Optic Studio. This will only succeed when the client application was launched by Optic Studio.
 
IZOSAPI_Application CreateNewApplication ()
 Attempts to launch a new instance of Optic Studio in 'headless' mode. Note that although the Optic Studio window will not be visible, it still requires an active license.
 
IZOSAPI_Application CreateZemaxServer (string applicationName)
 For internal use only.
 
IZOSAPI_Application CreateZemaxServerEx (string applicationName, string libraryPath)
 
IZOSAPI_Application ConnectAsExtension (int zemaxInstance)
 Connects to an existing instance of OpticStudio in extension mode.
 
string RunCommand (string command)
 For internal debugging purposes only.
 
string GetConfigSetting (string setting)
 
void SetConfigSetting (string setting, string Value)
 
void SetCreoInstallPath (string path)
 

Properties

bool IsAlive [get]
 Gets a value indicating whether ZOS-API connection is still active.
 
string InitializationSettings [get, set]
 For internal use only.
 
int[] IntializationProgress [get]
 The initialization progress can be used to help debug any initial connection problems; only applicable when using CreateNewApplication.
 
double ConnectionTimeoutSeconds [get, set]
 Gets or sets the connection timeout (seconds). This is only used when launching a new OpticStudio instance, with CreateNewApplication.
 
string FormattingCulture [get, set]
 Gets or sets the culture used when converting numeric values to/from strings. Note that this must be set before calling CreateNewApplication, and has no effect when connecting to an existing instance of OpticStudio.
 
string PreferencesFile [get, set]
 For standalone ZOS-API applications, this controls the file that will be used to specify all OpticStudio Preferences settings. If no file is specified, all settings will be loaded from the OpticStudio.CFG preferences file, however any changes will not be persisted between sessions.
 

Detailed Description

This is the initial interface to Optic Studio. All applications that wish to use the ZOS-API must first establish a connection, using the T:ZOSAPI.ZOSAPI_Connection class.

Member Function Documentation

◆ ConnectAsExtension()

IZOSAPI_Application ZOSAPI.IZOSAPI_Connection.ConnectAsExtension ( int  zemaxInstance)

Connects to an existing instance of OpticStudio in extension mode.

Parameters
zemaxInstanceThe OpticStudio instance number to connect to (0 to connect to any available instance).
Returns

Implemented in ZOSAPI.ZOSAPI_Connection.

◆ ConnectToApplication()

IZOSAPI_Application ZOSAPI.IZOSAPI_Connection.ConnectToApplication ( )

Attempts to connect to Optic Studio. This will only succeed when the client application was launched by Optic Studio.

Standalone applications should use CreateNewApplication.

Returns
Exceptions
System.ArgumentExceptionThis application was not launched by Optic Studio

Implemented in ZOSAPI.ZOSAPI_Connection.

◆ CreateNewApplication()

IZOSAPI_Application ZOSAPI.IZOSAPI_Connection.CreateNewApplication ( )

Attempts to launch a new instance of Optic Studio in 'headless' mode. Note that although the Optic Studio window will not be visible, it still requires an active license.

Plugins, user analyses, and user operands should instead use ConnectToApplication.

Returns

Implemented in ZOSAPI.ZOSAPI_Connection.

◆ CreateZemaxServer()

IZOSAPI_Application ZOSAPI.IZOSAPI_Connection.CreateZemaxServer ( string  applicationName)

For internal use only.

Parameters
applicationName
Returns

Implemented in ZOSAPI.ZOSAPI_Connection.

◆ CreateZemaxServerEx()

IZOSAPI_Application ZOSAPI.IZOSAPI_Connection.CreateZemaxServerEx ( string  applicationName,
string  libraryPath 
)

Implemented in ZOSAPI.ZOSAPI_Connection.

◆ GetConfigSetting()

string ZOSAPI.IZOSAPI_Connection.GetConfigSetting ( string  setting)

Implemented in ZOSAPI.ZOSAPI_Connection.

◆ RunCommand()

string ZOSAPI.IZOSAPI_Connection.RunCommand ( string  command)

For internal debugging purposes only.

Parameters
command
Returns

Implemented in ZOSAPI.ZOSAPI_Connection.

◆ SetConfigSetting()

void ZOSAPI.IZOSAPI_Connection.SetConfigSetting ( string  setting,
string  Value 
)

Implemented in ZOSAPI.ZOSAPI_Connection.

◆ SetCreoInstallPath()

void ZOSAPI.IZOSAPI_Connection.SetCreoInstallPath ( string  path)

Implemented in ZOSAPI.ZOSAPI_Connection.

Property Documentation

◆ ConnectionTimeoutSeconds

double ZOSAPI.IZOSAPI_Connection.ConnectionTimeoutSeconds
getset

Gets or sets the connection timeout (seconds). This is only used when launching a new OpticStudio instance, with CreateNewApplication.

The connection timeout (seconds).

Implemented in ZOSAPI.ZOSAPI_Connection.

◆ FormattingCulture

string ZOSAPI.IZOSAPI_Connection.FormattingCulture
getset

Gets or sets the culture used when converting numeric values to/from strings. Note that this must be set before calling CreateNewApplication, and has no effect when connecting to an existing instance of OpticStudio.

The standard culture name to use. Examples: "en-US" for English (United States), or "de-DE" for German (Germany)

Implemented in ZOSAPI.ZOSAPI_Connection.

◆ InitializationSettings

string ZOSAPI.IZOSAPI_Connection.InitializationSettings
getset

For internal use only.

The initialization settings string.

Implemented in ZOSAPI.ZOSAPI_Connection.

◆ IntializationProgress

int [] ZOSAPI.IZOSAPI_Connection.IntializationProgress
get

The initialization progress can be used to help debug any initial connection problems; only applicable when using CreateNewApplication.

The intialization progress.

Implemented in ZOSAPI.ZOSAPI_Connection.

◆ IsAlive

bool ZOSAPI.IZOSAPI_Connection.IsAlive
get

Gets a value indicating whether ZOS-API connection is still active.

true if this instance is active; otherwise, false.

Implemented in ZOSAPI.ZOSAPI_Connection.

◆ PreferencesFile

string ZOSAPI.IZOSAPI_Connection.PreferencesFile
getset

For standalone ZOS-API applications, this controls the file that will be used to specify all OpticStudio Preferences settings. If no file is specified, all settings will be loaded from the OpticStudio.CFG preferences file, however any changes will not be persisted between sessions.

Implemented in ZOSAPI.ZOSAPI_Connection.

Connect with Ansys