ZOSAPI.ZOSAPI_Connection Class Reference
Last update: 17.07.2025
Public Member Functions | |||
| ZOSAPI_Connection () | |||
| Initializes a new instance of the ZOSAPI_Connection class. | |||
| IZOSAPI_Application | 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.
| |||
| IZOSAPI_Application | ConnectAsExtension (int zemaxInstance) | ||
| Connects to an existing instance of OpticStudio in extension mode. | |||
| 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.Plugins, user analyses, and user operands should instead use ConnectToApplication.
| |||
| void | AddInitializationProgress (int status) | ||
| IZOSAPI_Application | CreateZemaxServer (string applicationName) | ||
| For internal use only. | |||
| IZOSAPI_Application | CreateZemaxServerEx (string applicationName, string libraryPath) | ||
| string | RunCommand (string command) | ||
| For internal debugging purposes only. | |||
| string | GetConfigSetting (string setting) | ||
| void | SetConfigSetting (string setting, string value) | ||
| void | SetCreoInstallPath (string path) | ||
| 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 | |
| static IZOSAPI_Application | TheApp [get, set] |
| bool | IsAlive [get] |
Gets a value indicating whether ZOS-API connection is still active.true if this instance is active; otherwise, false. | |
| 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 | InitializationSettings [get, set] |
| For internal use only. | |
| 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. | |
Properties inherited from ZOSAPI.IZOSAPI_Connection | |
| 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. | |
Events | |
| OpticalSystemStatusChangedHandler | SystemStatusChangedEvent |
| Connect to this event to receive notifications when the system changes from valid to invalid (or vice versa). | |
Detailed Description
- Examples
- CSharpStandalone_01_new_file_and_quickfocus.cs, CSharpStandalone_02_NSC_ray_trace.cs, CSharpStandalone_03_open_file_and_optimise.cs, CSharpStandalone_04_pull_data_from_FFTMTF.cs, CSharpStandalone_05_Read_ZRD_File.cs, CSharpStandalone_06_nsc_phase.cs, CSharpStandalone_07_TiltDecenterAndMFOperand.cs, CSharpStandalone_08_NSCEDetectorData.cs, CSharpStandalone_09_NSC_CAD.cs, CSharpStandalone_10_NSC_ZRD_filter_string.cs, CSharpStandalone_11_Basic_Seq.cs, CSharpStandalone_12_Seq_SystemExplorer.cs, CSharpStandalone_14_Seq_Tolerance.cs, CSharpStandalone_15_Seq_Optimization.cs, CSharpStandalone_17_NSC_BulkScatter.cs, CSharpStandalone_18_SetMulticonfiguration.cs, CSharpStandalone_19_Surface_Properties.cs, CSharpStandalone_20_export_CAD_File.cs, CSharpStandalone_21_White_LED_Phosphor.cs, CSharpStandalone_22_seq_spot_diagram.cs, CSharpStandalone_23_ray_fan_native_manual_comparison.cs, CSharpStandalone_24_nsc_detectors.cs, CSharpStandalone_25_source_spectrum_diffraction_grating.cs, CSharpStandalone_26_modify_opticstudio_preferences.cs, CSharpUserOperand_16_SumAbsoluteThickness.cs, CppStandalone_01_new_file_and_quickfocus.cpp, CppStandalone_02_NSC_ray_trace.cpp, CppStandalone_03_open_file_and_optimise.cpp, CppStandalone_04_pull_data_from_FFTMTF.cpp, CppStandalone_05_Read_ZRD_File.cpp, CppStandalone_06_nsc_phase.cpp, CppStandalone_07_TiltDecenterAndMFOperand.cpp, CppStandalone_08_NSCEDetectorData.cpp, CppStandalone_09_NSC_CAD.cpp, CppStandalone_10_NSC_ZRD_filter_string.cpp, CppStandalone_11_Basic_Seq.cpp, CppStandalone_12_Seq_SystemExplorer.cpp, CppStandalone_14_Seq_Tolerance.cpp, CppStandalone_15_Seq_Optimization.cpp, CppStandalone_17_NSC_BulkScatter.cpp, CppStandalone_18_SetMulticonfiguration.cpp, CppStandalone_19_Surface_Properties.cpp, CppStandalone_20_export_CAD_File.cpp, CppStandalone_21_White_LED_Phosphor.cpp, CppStandalone_22_seq_spot_diagram.cpp, CppStandalone_23_ray_fan_native_manual_comparison.cpp, CppStandalone_24_nsc_detectors.cpp, CppStandalone_25_source_spectrum_diffraction_grating.cpp, CppStandalone_26_modify_opticstudio_preferences.cpp, and CppUserOperand_16_SumAbsoluteThickness.cpp.
Constructor & Destructor Documentation
◆ ZOSAPI_Connection()
|
inline |
Initializes a new instance of the ZOSAPI_Connection class.
Member Function Documentation
◆ AddInitializationProgress()
|
inline |
◆ ConnectAsExtension()
|
inline |
Connects to an existing instance of OpticStudio in extension mode.
- Parameters
-
zemaxInstance The OpticStudio instance number to connect to (0 to connect to any available instance).
- Returns
Implements ZOSAPI.IZOSAPI_Connection.

◆ ConnectToApplication()
|
inline |
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.ArgumentException This application was not launched by Optic Studio
Implements ZOSAPI.IZOSAPI_Connection.
◆ CreateNewApplication()
|
inline |
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
Implements ZOSAPI.IZOSAPI_Connection.
- Examples
- CSharpStandalone_01_new_file_and_quickfocus.cs, CSharpStandalone_02_NSC_ray_trace.cs, CSharpStandalone_03_open_file_and_optimise.cs, CSharpStandalone_04_pull_data_from_FFTMTF.cs, CSharpStandalone_05_Read_ZRD_File.cs, CSharpStandalone_06_nsc_phase.cs, CSharpStandalone_07_TiltDecenterAndMFOperand.cs, CSharpStandalone_08_NSCEDetectorData.cs, CSharpStandalone_09_NSC_CAD.cs, CSharpStandalone_10_NSC_ZRD_filter_string.cs, CSharpStandalone_11_Basic_Seq.cs, CSharpStandalone_12_Seq_SystemExplorer.cs, CSharpStandalone_14_Seq_Tolerance.cs, CSharpStandalone_15_Seq_Optimization.cs, CSharpStandalone_17_NSC_BulkScatter.cs, CSharpStandalone_18_SetMulticonfiguration.cs, CSharpStandalone_19_Surface_Properties.cs, CSharpStandalone_20_export_CAD_File.cs, CSharpStandalone_21_White_LED_Phosphor.cs, CSharpStandalone_22_seq_spot_diagram.cs, CSharpStandalone_23_ray_fan_native_manual_comparison.cs, CSharpStandalone_24_nsc_detectors.cs, CSharpStandalone_25_source_spectrum_diffraction_grating.cs, and CSharpStandalone_26_modify_opticstudio_preferences.cs.
◆ CreateZemaxServer()
|
inline |
◆ CreateZemaxServerEx()
|
inline |
Implements ZOSAPI.IZOSAPI_Connection.
◆ GetConfigSetting()
|
inline |
Implements ZOSAPI.IZOSAPI_Connection.
◆ RunCommand()
|
inline |
For internal debugging purposes only.
- Parameters
-
command
- Returns
Implements ZOSAPI.IZOSAPI_Connection.

◆ SetConfigSetting()
|
inline |
◆ SetCreoInstallPath()
|
inline |
Property Documentation
◆ 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).
Implements 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)
Implements ZOSAPI.IZOSAPI_Connection.
◆ InitializationSettings
|
getset |
◆ IntializationProgress
|
get |
The initialization progress can be used to help debug any initial connection problems; only applicable when using CreateNewApplication.
The intialization progress.
Implements ZOSAPI.IZOSAPI_Connection.
◆ IsAlive
|
get |
Gets a value indicating whether ZOS-API connection is still active.true if this instance is active; otherwise, false.
Implements 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.
Implements ZOSAPI.IZOSAPI_Connection.
◆ TheApp
|
staticgetset |
Event Documentation
◆ SystemStatusChangedEvent
| OpticalSystemStatusChangedHandler ZOSAPI.ZOSAPI_Connection.SystemStatusChangedEvent |
Connect to this event to receive notifications when the system changes from valid to invalid (or vice versa).
Properties inherited from 
