> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ZOSAPI Namespace Reference

The [ZOSAPI](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/namespace_z_o_s_a_p_i) namespace contains classes for initially connecting to zemax. See also [ZOSAPI\_Connection](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/class_z_o_s_a_p_i_1_1_z_o_s_a_p_i___connection.md), and [IZOSAPI\_Application](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.md) for more information.

## Namespaces

| Type | Name |
| - | - |
| namespace | [Analysis](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/namespace_z_o_s_a_p_i_1_1_analysis) |
| namespace | [Common](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/namespace_z_o_s_a_p_i_1_1_common) |
| namespace | [Editors](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/namespace_z_o_s_a_p_i_1_1_editors) |
| namespace | [Preferences](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/namespace_z_o_s_a_p_i_1_1_preferences) |
| namespace | [SystemData](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/namespace_z_o_s_a_p_i_1_1_system_data) |
| namespace | [Tools](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/namespace_z_o_s_a_p_i_1_1_tools) |
| namespace | [Wizards](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/namespace_z_o_s_a_p_i_1_1_wizards) |

## Classes

| Type | Name |
| - | - |
| class | [APINetCallback](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/class_z_o_s_a_p_i_1_1_a_p_i_net_callback.md) |
| interface | [IOpticalSystem](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/interface_z_o_s_a_p_i_1_1_i_optical_system.md) Represent a complete optical system. A IOpticalSystem corresponds to a single .ZMX file. See IZOSAPI\_Application for information on how to get or create a IOpticalSystem. |
| interface | [IPreferences](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/interface_z_o_s_a_p_i_1_1_i_preferences.md) |
| interface | [ISTARMaterials](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/interface_z_o_s_a_p_i_1_1_i_s_t_a_r_materials.md) Top-level access to material properties for STAR module. |
| interface | [ISTARSubsystem](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/interface_z_o_s_a_p_i_1_1_i_s_t_a_r_subsystem.md) Controls the STAR module at the optical system level. |
| interface | [IZAPI\_BaseObject](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/interface_z_o_s_a_p_i_1_1_i_z_a_p_i___base_object.md) |
| interface | [IZOSAPI\_Application](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.md) This interface contains all information about the current ZOS-API connection, as well as methods for accessing an Optical System. This interface can only be retrieved from a connection interface - [ZOSAPI.IZOSAPI\_Connection](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___connection.md) for more information. |
| interface | [IZOSAPI\_Callback](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___callback.md) |
| interface | [IZOSAPI\_Connection](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___connection.md) 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. |
| interface | [IZOSAPI\_Events](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___events.md) COM classes can inherit from this interface if they wish to receive status changed notifications. See also ZOSAPI\_Connection.SystemStatusChangedEvent. |
| class | [ZOSAPI\_Connection](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/class_z_o_s_a_p_i_1_1_z_o_s_a_p_i___connection.md) |

## Enumerations

| Type | Name |
| - | - |
| enum | [SystemType](#a3c37540f7b61a272f4eb50e826d27daf) \{ [Sequential](#a3c37540f7b61a272f4eb50e826d27dafaa7e82daa7280af25afbaa076ac16eb1e) , [NonSequential](#a3c37540f7b61a272f4eb50e826d27dafa12d3de3f72d530905c690c2750951117) } |
| enum | [LicenseStatusType](#a7c677ca4eca8285cae8730422280493e) \{  [Unknown](#a7c677ca4eca8285cae8730422280493ea88183b946cc5f0e8c96b2e66e1c74a7e) = 0 , [KeyNotWorking](#a7c677ca4eca8285cae8730422280493eae30c3d85ccc285b6c4cf428f13fc1bb2) , [NewLicenseNeeded](#a7c677ca4eca8285cae8730422280493ea63f7c30d809599bf49ef8d5d518f3ab8) , [StandardEdition](#a7c677ca4eca8285cae8730422280493ea80bcaf4301377c8b5dcd277ca28a7bb4) ,  [ProfessionalEdition](#a7c677ca4eca8285cae8730422280493ea2ed95be70a6ab6372a8dda3ebfd214d5) , [PremiumEdition](#a7c677ca4eca8285cae8730422280493ead7c251f26e809b1c6294fa8c0a69b4f5) , [TooManyInstances](#a7c677ca4eca8285cae8730422280493eaa5ea7465492a8c5d19fbc46e789044b5) , [NotAuthorized](#a7c677ca4eca8285cae8730422280493ea418ec6476e1acd92e17681f4bd00e3a3) ,  [KeyNotFound](#a7c677ca4eca8285cae8730422280493eaa645e4cfc8d16be330607ad52aec5f98) , [KeyExpired](#a7c677ca4eca8285cae8730422280493ea3995421f2329ce6d6ba6b4ffad1e58ce) , [Timeout](#a7c677ca4eca8285cae8730422280493eac85a251cc457840f1e032f1b733e9398) , [InstanceConflict](#a7c677ca4eca8285cae8730422280493ea97ab5524427a661ccb9cd7bb133dd4ff) ,  [OpticsViewer](#a7c677ca4eca8285cae8730422280493ea0a55f5a93264f08c562bd0e8fa0f0e02) , [OpticStudioHPCEdition](#a7c677ca4eca8285cae8730422280493ea095d0bde25fd250873df0bc05d84dd02) , [EnterpriseEdition](#a7c677ca4eca8285cae8730422280493ea5fb4297717b3cc0d12b46f3f59fe9ecd) , [StudentEdition](#a7c677ca4eca8285cae8730422280493ea732e0ba6a7d77f2f69b03fe6a52edc6d)  } |
| enum | [UpdateStatus](#ae1500a9901bf1c5a361d63d4fac19d9a) \{  [CheckFailed](#ae1500a9901bf1c5a361d63d4fac19d9aa67964924cf2737ff8335b0fed52d430f) = -2 , [NotSupported](#ae1500a9901bf1c5a361d63d4fac19d9aa9ed2d871602556951e39f3cebd08d6cb) = -1 , [NotChecked](#ae1500a9901bf1c5a361d63d4fac19d9aac9c0fcb2bb86adc799c4b7eb02412379) = 0 , [UpToDate](#ae1500a9901bf1c5a361d63d4fac19d9aa761266b390b3dc960c74d9194512850a) = 1 ,  [AvailableEligible](#ae1500a9901bf1c5a361d63d4fac19d9aad7c00931b9215da584bea3cc46e9d52e) = 2 , [AvailableIneligible](#ae1500a9901bf1c5a361d63d4fac19d9aabf78d5d426412bd40a10e886e14da89c) = 3  } |
| enum | [ZOSAPI\_Mode](#a254f5f6cb4ff37c2245b456b9bb79d2a) \{  [Server](#a254f5f6cb4ff37c2245b456b9bb79d2aa9aa1b03934893d7134a660af4204f2a9) , [Operand](#a254f5f6cb4ff37c2245b456b9bb79d2aa1b488933c47964ca059d24f978f094e4) , [Plugin](#a254f5f6cb4ff37c2245b456b9bb79d2aa409c1892b68cb394799262ac57f6d4f1) , [UserAnalysis](#a254f5f6cb4ff37c2245b456b9bb79d2aa64eebbd15ce06c7625d3e50c3d7b2cbd) ,  [UserAnalysisSettings](#a254f5f6cb4ff37c2245b456b9bb79d2aab71755803158960255ee23dc613d4ac2)  } |
| enum | [LensUpdateMode](#a928284b47bbcad0717a234689558250a) \{ [None](#a928284b47bbcad0717a234689558250aa6adf97f83acf6453d4a6a4b1070f3754) = 0 , [EditorsOnly](#a928284b47bbcad0717a234689558250aa52a1d4089c743f81411a51a99d90a2e1) = 1 , [AllWindows](#a928284b47bbcad0717a234689558250aa59ffd36b33cc5de3325845c3353ec433) = 2 } |
| enum | [SessionModes](#a0bbab31714d9ab6077ce3a689a286f42) \{ [FromPreferences](#a0bbab31714d9ab6077ce3a689a286f42a8e0a81536e3612d31a704c3ece62a68f) = 0 , [SessionOn](#a0bbab31714d9ab6077ce3a689a286f42a1f6ef1cc58fdff6cdfd7c8f5dda169ad) = 1 , [SessionOff](#a0bbab31714d9ab6077ce3a689a286f42a5735ac012ce18416658c0d7462c32be8) = 2 } |
| enum | [STARUpdateMode](#a55b9060ae2fffe30bd5c6cb28e8cd164) \{ [Normal](#a55b9060ae2fffe30bd5c6cb28e8cd164a960b44c579bc2f6818d2daaf9e4c16f0) , [Suspended](#a55b9060ae2fffe30bd5c6cb28e8cd164a8bf906833cc7aea8084f552217ed9c1d) } |

## Functions

| Type | Name |
| - | - |
| delegate void | [OpticalSystemStatusChangedHandler](#afaf981c5f923ffd5800be6562f3ebc0a) (int systemId, string newStatus) |

## Detailed Description

The [ZOSAPI](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/namespace_z_o_s_a_p_i) namespace contains classes for initially connecting to zemax. See also [ZOSAPI\_Connection](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/class_z_o_s_a_p_i_1_1_z_o_s_a_p_i___connection.md), and [IZOSAPI\_Application](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.md) for more information.

## Enumeration Type Documentation

### LensUpdateMode

```csharp theme={null}
enum ZOSAPI.LensUpdateMode
```

| Enumerator | |
| - | - |
| None | |
| EditorsOnly | |
| AllWindows | |

### LicenseStatusType

```csharp theme={null}
enum ZOSAPI.LicenseStatusType
```

Usage (see [Example 10](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/2025-r1/page_ex10) for a full sample)

C#

```csharp theme={null}
 // Save Ray Path Analysis to Text File
 if (TheApplication.LicenseStatus == ZOSAPI.LicenseStatusType.PremiumEdition)
            {
                IA_ RayPath = TheSystem.Analyses.New_Analysis(AnalysisIDM.PathAnalysis);
 ZOSAPI.Analysis.RayTracing.IAS_PathAnalysis RayPath_settings = RayPath.GetSettings() as ZOSAPI.Analysis.RayTracing.IAS_PathAnalysis;
                RayPath_settings.RayDatabaseFile = "e10_API_RayTrace.ZRD";
                RayPath.ApplyAndWaitForCompletion();
                IAR_ Rays = RayPath.GetResults();
                Rays.GetTextFile(TheApplication.SamplesDir + "\\API\\CS\\e10_RayPathAnalysis.txt");
            }
 else
            {
                Console.Write("\nThe RayPathAnalysis is a premium feature only\n\nPress any key to continue\n");
                Console.ReadKey();
            }
```

C++

```csharp theme={null}
 // Save Ray Path Analysis to Text File
 if (TheApplication->LicenseStatus == ZOSAPI_Interfaces::LicenseStatusType::LicenseStatusType_PremiumEdition) {
        IA_Ptr RayPath = TheSystem->Analyses->New_Analysis(AnalysisIDM_PathAnalysis);
        ZOSAPI_Interfaces::IAS_PathAnalysisPtr RayPath_settings = RayPath->GetSettings();
        RayPath_settings->RayDatabaseFile = "e10_API_RayTrace.ZRD";
        RayPath->ApplyAndWaitForCompletion();

        IAR_Ptr Rays = RayPath->GetResults();
        Rays->GetTextFile(TheApplication->SamplesDir + "\\API\\CPP\\e10_RayPathAnalysis.txt");
    }
```

Matlab

```csharp theme={null}
    % Save Ray Path Analysis to Text File
 if TheApplication.LicenseStatus == ZOSAPI.LicenseStatusType.PremiumEdition
        RayPath = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.PathAnalysis);
        RayPath_settings = RayPath.GetSettings();
        RayPath_settings.RayDatabaseFile = 'e10_API_Raytrace.ZRD';
        RayPath.ApplyAndWaitForCompletion();
        Rays = RayPath.GetResults();
        Rays.GetTextFile(System.String.Concat(TheApplication.SamplesDir, '\API\Matlab\e10_RayPathAnalysis.txt'));
 else
        fprintf('\nThe RayPathAnalysis is a premium feature only\n');
    end
```

Python

```csharp theme={null}
 # Save Ray Path Analysis to Text File
 if (TheApplication.LicenseStatus == ZOSAPI.LicenseStatusType.PremiumEdition):
 # there is a bug in ZOS16.5 SP4 with COM; need to use ZOS16.5 SP5 or higher to run this code successfully
        RayPath = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.PathAnalysis)
        RayPath_settings = RayPath.GetSettings()
        zrd = "e10_API_RayTrace.ZRD"
        RayPath_settings.RayDatabaseFile = zrd
        RayPath.ApplyAndWaitForCompletion()

        Rays = RayPath.GetResults()
        Rays.GetTextFile(TheApplication.SamplesDir + "\\API\\Python\\e10_RayPathAnalysis.txt")
```

| Enumerator | |
| - | - |
| Unknown | |
| KeyNotWorking | |
| NewLicenseNeeded | |
| StandardEdition | |
| ProfessionalEdition | |
| PremiumEdition | |
| TooManyInstances | |
| NotAuthorized | |
| KeyNotFound | |
| KeyExpired | |
| Timeout | |
| InstanceConflict | |
| OpticsViewer | |
| OpticStudioHPCEdition | |
| EnterpriseEdition | |
| StudentEdition | |

### SessionModes

```csharp theme={null}
enum ZOSAPI.SessionModes
```

| Enumerator | |
| - | - |
| FromPreferences | |
| SessionOn | |
| SessionOff | |

### STARUpdateMode

```csharp theme={null}
enum ZOSAPI.STARUpdateMode
```

| Enumerator | |
| - | - |
| Normal | |
| Suspended | |

### SystemType

```csharp theme={null}
enum ZOSAPI.SystemType
```

| Enumerator | |
| - | - |
| Sequential | |
| NonSequential | |

### UpdateStatus

```csharp theme={null}
enum ZOSAPI.UpdateStatus
```

| Enumerator | |
| - | - |
| CheckFailed | |
| NotSupported | |
| NotChecked | |
| UpToDate | |
| AvailableEligible | |
| AvailableIneligible | |

### ZOSAPI\_Mode

```csharp theme={null}
enum ZOSAPI.ZOSAPI_Mode
```

| Enumerator | |
| - | - |
| Server | The connection is running in server or headless mode. |
| Operand | User operand mode. |
| Plugin | Extension mode. |
| UserAnalysis | User analysis mode – perform the calculation. |
| UserAnalysisSettings | User analysis mode – display/configure the analysis settings. |

## Function Documentation

### OpticalSystemStatusChangedHandler()

```csharp theme={null}
delegate void ZOSAPI.OpticalSystemStatusChangedHandler(
    int systemId,
    string newStatus
)
```
