Skip to main content

ZOS-API interface 2024 R1

ZOSAPI Namespace Reference

Last update: 17.07.2025

The ZOSAPI namespace contains classes for initially connecting to zemax. See also ZOSAPI_Connection, and IZOSAPI_Application for more information. More...

Namespaces

namespace  Analysis
 
namespace  Common
 
namespace  Editors
 
namespace  Preferences
 
namespace  SystemData
 
namespace  Tools
 
namespace  Wizards
 

Classes

class  APINetCallback
 
interface  IOpticalSystem
 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. More...
 
interface  IPreferences
 
interface  ISTARMaterials
 Top-level access to material properties for STAR module. More...
 
interface  ISTARSubsystem
 Controls the STAR module at the optical system level. More...
 
interface  IZAPI_BaseObject
 
interface  IZOSAPI_Application
 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 for more information. More...
 
interface  IZOSAPI_Callback
 
interface  IZOSAPI_Connection
 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...
 
interface  IZOSAPI_Events
 COM classes can inherit from this interface if they wish to receive status changed notifications. See also ZOSAPI_Connection.SystemStatusChangedEvent. More...
 
class  ZOSAPI_Connection
 

Enumerations

enum  SystemType { Sequential , NonSequential }
 
enum  LicenseStatusType {
  Unknown = 0 , KeyNotWorking , NewLicenseNeeded , StandardEdition ,
  ProfessionalEdition , PremiumEdition , TooManyInstances , NotAuthorized ,
  KeyNotFound , KeyExpired , Timeout , InstanceConflict ,
  OpticsViewer , OpticStudioHPCEdition , EnterpriseEdition
}
 
enum  UpdateStatus {
  CheckFailed = -2 , NotSupported = -1 , NotChecked = 0 , UpToDate = 1 ,
  AvailableEligible = 2 , AvailableIneligible = 3
}
 
enum  ZOSAPI_Mode {
  Server , Operand , Plugin , UserAnalysis ,
  UserAnalysisSettings
}
 
enum  LensUpdateMode { None = 0 , EditorsOnly = 1 , AllWindows = 2 }
 
enum  SessionModes { FromPreferences = 0 , SessionOn = 1 , SessionOff = 2 }
 
enum  STARUpdateMode { Normal , Suspended }
 

Functions

delegate void OpticalSystemStatusChangedHandler (int systemId, string newStatus)
 

Detailed Description

The ZOSAPI namespace contains classes for initially connecting to zemax. See also ZOSAPI_Connection, and IZOSAPI_Application for more information.

Enumeration Type Documentation

◆ LensUpdateMode

Enumerator
None 
EditorsOnly 
AllWindows 

◆ LicenseStatusType

Usage (see Example 10 for a full sample)

C#

// Save Ray Path Analysis to Text File
if (TheApplication.LicenseStatus == ZOSAPI.LicenseStatusType.PremiumEdition)
{
IA_ RayPath = TheSystem.Analyses.New_Analysis(AnalysisIDM.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();
}
Definition: IAS_PathAnalysis.cs:40
Definition: IAS_PathAnalysis.cs:10
Definition: IAS_FieldCurvatureAndDistortion.cs:5
The ZOSAPI namespace contains classes for initially connecting to zemax. See also ZOSAPI_Connection,...
Definition: IAS_FieldCurvatureAndDistortion.cs:5

C++

// 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

% 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

# 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 

◆ SessionModes

Enumerator
FromPreferences 
SessionOn 
SessionOff 

◆ STARUpdateMode

Enumerator
Normal 
Suspended 

◆ SystemType

Enumerator
Sequential 
NonSequential 

◆ UpdateStatus

Enumerator
CheckFailed 
NotSupported 
NotChecked 
UpToDate 
AvailableEligible 
AvailableIneligible 

◆ 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()

delegate void ZOSAPI.OpticalSystemStatusChangedHandler ( int  systemId,
string  newStatus 
)

Connect with Ansys