Skip to main content

ZOS-API interface 2025 R1

ZOSAPI.Tools.RayTrace Namespace Reference

Last update: 17.07.2025

Classes

interface  IBatchRayTrace
 Interfaces and methods for running a ray trace on multiple rays at a time. This interface can be accessed via the IOpticalSystemTools interface. More...
 
interface  ILightningTrace
 Interfaces and methods for running the LightningTrace tool. This interface can be accessed via the IOpticalSystemTools interface. More...
 
interface  INSCRayTrace
 Interfaces and methods for running a non-sequential ray trace. This interface can be accessed via the IOpticalSystemTools interface. NOTE - due to architectural limitations, currently only one INSCRayTrace instance can be used at a time, across all IOpticalSystem instances. The first call to IOpticalSystemTools.OpenNSCRayTrace will succeed, while all further calls will return null until the the single INSCRayTrace instance is closed. It is anticipated that this limiation will be removed in future versions of the API. More...
 
interface  IRayTraceDirectPolData
 
interface  IRayTraceDirectUnpolData
 
interface  IRayTraceNormPolData
 
interface  IRayTraceNormUnpolData
 
interface  IRayTraceNSCData
 
interface  IRayTraceNSCSourceData
 
interface  IZRDReader
 
interface  IZRDReaderResults
 

Enumerations

enum  ZRDFormatType { UncompressedFullData = 0 , CompressedBasicData = 1 , CompressedFullData = 2 }
 
enum  LTRaySampling {
  S_1X_Low = 0 , S_4X , S_16X , S_64X ,
  S_256X , S_1024X
}
 
enum  LTEdgeSasmpling {
  S_1X_Low = 0 , S_4X , S_16X , S_64X ,
  S_256X
}
 
enum  RaysType { Real , Paraxial }
 
enum  OPDMode { None , Current , CurrentAndChief }
 
enum  NSCTraceOptions {
  None = 0 , UsePolarization = 1 , UseSplitting = 2 , UseScattering = 4 ,
  UsePolarizationSplitting = 3 , UsePolarizationScattering = 5 , UseSplittingScattering = 6 , UsePolarizationSplittingScattering = 7
}
 
enum  RayStatus {
  Parent = 0x00000000 , Terminated = 0x00000001 , Reflected = 0x00000002 , Transmitted = 0x00000004 ,
  Scattered = 0x00000008 , Diffracted = 0x00000010 , GhostedFrom = 0x00000020 , DiffractedFrom = 0x00000040 ,
  ScatteredFrom = 0x00000080 , RayError = 0x00000100 , BulkScattered = 0x00000200 , WaveShifted = 0x00000400 ,
  TIR = 0x00000800 , OrdinaryRay = 0x00010000 , ExtraordinaryRay = 0x00020000 , WaveShiftPL = 0x00040000
}
 

Enumeration Type Documentation

◆ LTEdgeSasmpling

Enumerator
S_1X_Low 
S_4X 
S_16X 
S_64X 
S_256X 

◆ LTRaySampling

Enumerator
S_1X_Low 
S_4X 
S_16X 
S_64X 
S_256X 
S_1024X 

◆ NSCTraceOptions

Enumerator
None 
UsePolarization 
UseSplitting 
UseScattering 
UsePolarizationSplitting 
UsePolarizationScattering 
UseSplittingScattering 
UsePolarizationSplittingScattering 

◆ OPDMode

Usage (see Example 23 for a full sample)

C#

// image surface number and primary wavelength
int pwav = 0;
for (int a = 1; a <= TheSystem.SystemData.Wavelengths.NumberOfWavelengths; a++)
{
if (TheSystem.SystemData.Wavelengths.GetWavelength(a).IsPrimary)
pwav = a;
}
// creates array of Y coordinate chief ray values
double[] chief_ary = new double[max_num_field];
for (int field = 1; field <= max_num_field; field++)
{
double hy = TheSystem.SystemData.Fields.GetField(field).Y / max_field;
// gets single value without using MFE(see ZPL OPEV)
chief_ary[field - 1] = TheSystem.MFE.GetOperandValue(ZOSAPI.Editors.MFE.MeritOperandType.REAY, nsur, pwav, 0, hy, 0, 0, 0, 0);
}
Definition: InterfacesMFE.cs:12
Definition: InterfacesEditors.cs:12
The ZOSAPI namespace contains classes for initially connecting to zemax. See also ZOSAPI_Connection,...
Definition: IAS_FieldCurvatureAndDistortion.cs:5

C++

// image surface number and primary wavelength
//
int pwav = 0;
for (int a = 1; a <= TheSystem->SystemData->Wavelengths->NumberOfWavelengths; a++) {
if (TheSystem->SystemData->Wavelengths->GetWavelength(a)->IsPrimary)
pwav = a;
}
// creates array of Y coordinate chief ray values
double *chief_ary = new double[max_num_field];
for (int field = 1; field <= max_num_field; field++) {
double hy = TheSystem->SystemData->Fields->GetField(field)->Y / max_field;
// gets single value without using MFE(see ZPL OPEV)
chief_ary[field - 1] = TheSystem->MFE->GetOperandValue(MeritOperandType_REAY, nsur, pwav, 0, hy, 0, 0, 0, 0);
}

Matlab

% image surface number and primary wavelength
nsur = TheSystem.LDE.NumberOfSurfaces;
pwav = 0;
for a = 1:TheSystem.SystemData.Wavelengths.NumberOfWavelengths
if TheSystem.SystemData.Wavelengths.GetWavelength(a).IsPrimary == 1; pwav = a; end;
end
% creates array of Y coordinate chief ray values
chief_ary = zeros(max_num_field);
for field = 1:max_num_field
if max_field == 0; hy = 1; else hy = TheSystem.SystemData.Fields.GetField(field).Y / max_field; end;
% gets single value without using MFE (see ZPL OPEV)
chief_ary(field) = TheSystem.MFE.GetOperandValue(ZOSAPI.Editors.MFE.MeritOperandType.REAY, nsur, pwav, 0, hy , 0, 0, 0, 0);
end

Python

# image surface number and primary wavelength
nsur = TheSystem.LDE.NumberOfSurfaces
pwav = 0
for a in range(1, TheSystem.SystemData.Wavelengths.NumberOfWavelengths + 1):
if TheSystem.SystemData.Wavelengths.GetWavelength(a).IsPrimary == 1:
pwav = a
# creates array of Y coordinate chief ray values
chief_ary = np.zeros(max_num_field)
for field in range(1, max_num_field + 1):
#hy = TheSystem.SystemData.Fields.GetField(field).Y / max_field
hy = 1 if max_field == 0 else TheSystem.SystemData.Fields.GetField(field).Y / max_field
# gets single value without using MFE (see ZPL OPEV)
chief_ary[field - 1] = TheSystem.MFE.GetOperandValue(ZOSAPI.Editors.MFE.MeritOperandType.REAY, nsur, pwav, 0, hy , 0, 0, 0, 0)
Enumerator
None 
Current 
CurrentAndChief 

◆ RayStatus

Enumerator
Parent 
Terminated 
Reflected 
Transmitted 
Scattered 
Diffracted 
GhostedFrom 
DiffractedFrom 
ScatteredFrom 
RayError 
BulkScattered 
WaveShifted 
TIR 
OrdinaryRay 
ExtraordinaryRay 
WaveShiftPL 

◆ RaysType

Enumerator
Real 
Paraxial 

◆ ZRDFormatType

Enumerator
UncompressedFullData 
CompressedBasicData 
CompressedFullData 

Connect with Ansys