> ## 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.

# Namespace ZOSAPI

![][C#]

**Definition**:

The [ZOSAPI](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/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/reference/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/reference/interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.md) for more information.

## Child namespaces

* [ZOSAPI::Analysis](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/namespace_z_o_s_a_p_i_1_1_analysis)
* [ZOSAPI::Common](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/namespace_z_o_s_a_p_i_1_1_common.md)
* [ZOSAPI::Editors](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/namespace_z_o_s_a_p_i_1_1_editors)
* [ZOSAPI::Preferences](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/namespace_z_o_s_a_p_i_1_1_preferences.md)
* [ZOSAPI::SystemData](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/namespace_z_o_s_a_p_i_1_1_system_data.md)
* [ZOSAPI::Tools](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/namespace_z_o_s_a_p_i_1_1_tools)
* [ZOSAPI::Wizards](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/namespace_z_o_s_a_p_i_1_1_wizards.md)

## Classes

* [ZOSAPI::IOpticalSystem](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/interface_z_o_s_a_p_i_1_1_i_optical_system.md)
* [ZOSAPI::IPreferences](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/interface_z_o_s_a_p_i_1_1_i_preferences.md)
* [ZOSAPI::ISTARMaterials](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/interface_z_o_s_a_p_i_1_1_i_s_t_a_r_materials.md)
* [ZOSAPI::ISTARSubsystem](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/interface_z_o_s_a_p_i_1_1_i_s_t_a_r_subsystem.md)
* [ZOSAPI::ISTARTools](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/interface_z_o_s_a_p_i_1_1_i_s_t_a_r_tools.md)
* [ZOSAPI::IZAPI\_BaseObject](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/interface_z_o_s_a_p_i_1_1_i_z_a_p_i___base_object.md)
* [ZOSAPI::IZOSAPI\_Application](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.md)
* [ZOSAPI::IZOSAPI\_Callback](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___callback.md)
* [ZOSAPI::IZOSAPI\_Connection](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___connection.md)
* [ZOSAPI::IZOSAPI\_Events](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___events.md)
* [ZOSAPI::ZOSAPI\_Connection](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/reference/class_z_o_s_a_p_i_1_1_z_o_s_a_p_i___connection.md)

## Enumeration types

### Enumeration type SystemType

![][public]

**Definition**:

```csharp theme={null}
enum SystemType {
  Sequential,
  NonSequential
}
```

#### Enumerator Sequential

#### Enumerator NonSequential

### Enumeration type LicenseStatusType

![][public]

**Definition**:

```csharp theme={null}
enum LicenseStatusType {
  Unknown = 0,
  KeyNotWorking,
  NewLicenseNeeded,
  StandardEdition,
  ProfessionalEdition,
  PremiumEdition,
  TooManyInstances,
  NotAuthorized,
  KeyNotFound,
  KeyExpired,
  Timeout,
  InstanceConflict,
  OpticsViewer,
  OpticStudioHPCEdition,
  EnterpriseEdition,
  StudentEdition
}
```

Usage (see [Example 10](https://developer.synopsys.com/docs/zemax/zemax-opticstudio-zos-api/apiexamples/example_10.md) 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

#### Enumerator KeyNotWorking

#### Enumerator NewLicenseNeeded

#### Enumerator StandardEdition

#### Enumerator ProfessionalEdition

#### Enumerator PremiumEdition

#### Enumerator TooManyInstances

#### Enumerator NotAuthorized

#### Enumerator KeyNotFound

#### Enumerator KeyExpired

#### Enumerator Timeout

#### Enumerator InstanceConflict

#### Enumerator OpticsViewer

#### Enumerator OpticStudioHPCEdition

#### Enumerator EnterpriseEdition

#### Enumerator StudentEdition

### Enumeration type UpdateStatus

![][public]

**Definition**:

```csharp theme={null}
enum UpdateStatus {
  CheckFailed = -2,
  NotSupported = -1,
  NotChecked = 0,
  UpToDate = 1,
  AvailableEligible = 2,
  AvailableIneligible = 3
}
```

#### Enumerator CheckFailed

#### Enumerator NotSupported

#### Enumerator NotChecked

#### Enumerator UpToDate

#### Enumerator AvailableEligible

#### Enumerator AvailableIneligible

### Enumeration type ZOSAPI\_Mode

![][public]

**Definition**:

```csharp theme={null}
enum ZOSAPI_Mode {
  Server,
  Operand,
  Plugin,
  UserAnalysis,
  UserAnalysisSettings
}
```

#### Enumerator Server

The connection is running in server or headless mode.

#### Enumerator Operand

User operand mode.

#### Enumerator Plugin

Extension mode.

#### Enumerator UserAnalysis

User analysis mode \&ndash perform the calculation.

#### Enumerator UserAnalysisSettings

User analysis mode \&ndash display/configure the analysis settings.

### Enumeration type LensUpdateMode

![][public]

**Definition**:

```csharp theme={null}
enum LensUpdateMode {
  None = 0,
  EditorsOnly = 1,
  AllWindows = 2
}
```

#### Enumerator None

#### Enumerator EditorsOnly

#### Enumerator AllWindows

### Enumeration type SessionModes

![][public]

**Definition**:

```csharp theme={null}
enum SessionModes {
  FromPreferences = 0,
  SessionOn = 1,
  SessionOff = 2
}
```

#### Enumerator FromPreferences

#### Enumerator SessionOn

#### Enumerator SessionOff

### Enumeration type STARUpdateMode

![][public]

**Definition**:

```csharp theme={null}
enum STARUpdateMode {
  Normal,
  Suspended
}
```

#### Enumerator Normal

#### Enumerator Suspended

## Functions

### Function OpticalSystemStatusChangedHandler

![][public]

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

**Parameters**:

* int **systemId**
* string **newStatus**

**Return type**: delegate void

[public]: https://img.shields.io/badge/-public-brightgreen "public"

[C#]: https://img.shields.io/badge/language-C%23-blue "C#"

[static]: https://img.shields.io/badge/-static-lightgrey "static"
