Skip to main content

ZOS-API interface 2024 R2 SP02

ZOSAPI.SystemData.IFields Interface Reference

Last update: 17.07.2025

System Explorer - Fields Data. This interface can be accessed via the ISystemData interface. More...

Public Member Functions

IField GetField (int position)
 Gets the specified field.
 
IField AddField (double X, double Y, double Weight)
 Add a new field, after all the current fields.
 
bool RemoveField (int position)
 Removes the specified field.
 
void SetVignetting ()
 
void ClearVignetting ()
 
FieldType GetFieldType ()
 
void SetFieldType (FieldType type)
 Sets the field type definition for all fields.
 
bool MakeEqualAreaFields (int numberOfFields, double maximumField)
 Replaces the existing system fields with new fields spread over an equal area.
 
IMessage ApplyFieldWizard (FieldPattern pattern, int numberOfYFields, double maxFieldY, int numberOfXFields, double maxFieldX, int startAt, bool overwrite, bool includePickups)
 Adds new system fields with specified in the specified pattern.
 
IField InsertFieldAt (int fieldNumber)
 
bool DeleteFieldAt (int fieldNumber)
 
int DeleteFieldsAt (int fieldNumber, int numberOfFields)
 
int DeleteAllFields ()
 
IMessage ConvertToFieldType (FieldType type)
 

Properties

int NumberOfFields [get]
 Gets the number of fields currently defined in the system.
 
FieldNormalizationType Normalization [get, set]
 

Detailed Description

System Explorer - Fields Data. This interface can be accessed via the ISystemData interface.

Examples
CSharpStandalone_12_Seq_SystemExplorer.cs.

Member Function Documentation

◆ AddField()

IField ZOSAPI.SystemData.IFields.AddField ( double  X,
double  Y,
double  Weight 
)

Add a new field, after all the current fields.

Usage (see Example 01 for a full sample)

C#

// Fields
IField Field_1 = TheSystemData.Fields.GetField(1);
IField NewField_2 = TheSystemData.Fields.AddField(0, 5.0, 1.0);
System field data. This interface can be accessed via the IFields interface.
Definition: InterfacesSE.cs:977

C++

// Fields
IFieldPtr Field_1 = TheSystemData->Fields->GetField(1);
IFieldPtr NewField_2 = TheSystemData->Fields->AddField(0, 5.0, 1.0);

Matlab

% Fields
Field_1 = TheSystemData.Fields.GetField(1);
NewField_2 = TheSystemData.Fields.AddField(0,5.0,1.0);

Python

# Fields
Field_1 = TheSystemData.Fields.GetField(1)
NewField_2 = TheSystemData.Fields.AddField(0, 5.0, 1.0)
Parameters
XThe field X value.
YThe field Y value.
WeightThe field weight.
Returns
The new IField if there were less than twelve fields; otherwise,
null
.
Examples
CSharpStandalone_01_new_file_and_quickfocus.cs, and CSharpStandalone_15_Seq_Optimization.cs.

◆ ApplyFieldWizard()

IMessage ZOSAPI.SystemData.IFields.ApplyFieldWizard ( FieldPattern  pattern,
int  numberOfYFields,
double  maxFieldY,
int  numberOfXFields,
double  maxFieldX,
int  startAt,
bool  overwrite,
bool  includePickups 
)

Adds new system fields with specified in the specified pattern.

Parameters
patternThe new field pattern to use pattern.
numberOfYFieldsThe number of y fields or arms.
maxFieldYThe maximum field in the y-direction.
numberOfXFieldsThe number of x fields or radii.
maxFieldXThe maximum field in the x-direction.
startAtThe field # to start inserting or overwriting at.
overwriteif set to true overwrite the fields data, else insert new fields.
includePickupsif set to true add pickups after the maximum field values.
Returns
null if successful, otherwise an error message

◆ ClearVignetting()

void ZOSAPI.SystemData.IFields.ClearVignetting ( )

◆ ConvertToFieldType()

IMessage ZOSAPI.SystemData.IFields.ConvertToFieldType ( FieldType  type)

◆ DeleteAllFields()

int ZOSAPI.SystemData.IFields.DeleteAllFields ( )

◆ DeleteFieldAt()

bool ZOSAPI.SystemData.IFields.DeleteFieldAt ( int  fieldNumber)

◆ DeleteFieldsAt()

int ZOSAPI.SystemData.IFields.DeleteFieldsAt ( int  fieldNumber,
int  numberOfFields 
)

◆ GetField()

IField ZOSAPI.SystemData.IFields.GetField ( int  position)

Gets the specified field.

Usage (see Example 12 for a full sample)

C#

// Change field 1 to be X=1.0 and Y=2.0
ZOSAPI.SystemData.IField field1 = sysField.GetField(1);
field1.X = 1.0;
field1.Y = 2.0;

C++

// Change field 1 to be X=1.0 and Y=2.0
ZOSAPI_Interfaces::IFieldPtr field1 = sysField->GetField(1);
field1->X = 1.0;
field1->Y = 2.0;

Matlab

% Change field 1 to be X=1.0 and Y=2.0
field1 = sysField.GetField(1);
field1.X = 1.0;
field1.Y = 2.0;

Python

# Change field 1 to be x=1.0 and y=2.0
field1 = sysField.GetField(1)
field1.X = 1.0
field1.Y = 2.0
Parameters
positionThe field # to retrieve (1-MAX_FIELDS).
Returns
The specified IField, if the position is valid; otherwise, null.
Examples
CSharpStandalone_01_new_file_and_quickfocus.cs, CSharpStandalone_12_Seq_SystemExplorer.cs, and CSharpStandalone_15_Seq_Optimization.cs.

◆ GetFieldType()

FieldType ZOSAPI.SystemData.IFields.GetFieldType ( )

◆ InsertFieldAt()

IField ZOSAPI.SystemData.IFields.InsertFieldAt ( int  fieldNumber)

◆ MakeEqualAreaFields()

bool ZOSAPI.SystemData.IFields.MakeEqualAreaFields ( int  numberOfFields,
double  maximumField 
)

Replaces the existing system fields with new fields spread over an equal area.

Usage (see Example 15 for a full sample)

C#

//Add 3 fields
IField Field_1 = SystExplorer.Fields.GetField(1);
IField NewField_2 = SystExplorer.Fields.AddField(0, 5.0, 1.0);
SystExplorer.Fields.SetFieldType(ZOSAPI.SystemData.FieldType.ParaxialImageHeight);
SystExplorer.Fields.MakeEqualAreaFields(3, 21.6);
Definition: InterfacesSE.cs:11
The ZOSAPI namespace contains classes for initially connecting to zemax. See also ZOSAPI_Connection,...
Definition: IAS_FieldCurvatureAndDistortion.cs:5

C++

// Add 3 fields
IFieldPtr Field_1 = SystExplorer->Fields->GetField(1);
IFieldPtr NewField_2 = SystExplorer->Fields->AddField(0, 5.0, 1.0);
SystExplorer->Fields->SetFieldType(FieldType::FieldType_ParaxialImageHeight);
SystExplorer->Fields->MakeEqualAreaFields(3, 21.6);

Matlab

%Add 3 fields
Field_1 = SystExplorer.Fields.GetField(1);
NewField_2 = SystExplorer.Fields.AddField(0, 5.0, 1.0);
SystExplorer.Fields.SetFieldType(ZOSAPI.SystemData.FieldType.ParaxialImageHeight);
SystExplorer.Fields.MakeEqualAreaFields(3, 21.6);

Python

# Add 3 fields
Field_1 = SystExplorer.Fields.GetField(1)
NewField_2 = SystExplorer.Fields.AddField(0, 5.0, 1.0)
SystExplorer.Fields.SetFieldType(ZOSAPI.SystemData.FieldType.ParaxialImageHeight)
SystExplorer.Fields.MakeEqualAreaFields(3, 21.6)
Parameters
numberOfFieldsThe number of fields.
maximumFieldThe maximum field.
Returns
Examples
CSharpStandalone_15_Seq_Optimization.cs.

◆ RemoveField()

bool ZOSAPI.SystemData.IFields.RemoveField ( int  position)

Removes the specified field.

Parameters
positionThe field # to remove (1-MAX_FIELDS).
Returns
true
if the position is valid and there was at least two fields in the system; otherwise,
false
.

◆ SetFieldType()

void ZOSAPI.SystemData.IFields.SetFieldType ( FieldType  type)

Sets the field type definition for all fields.

Usage (see Example 12 for a full sample)

C#

// Define fields using Paraxial Image Height
ZOSAPI.SystemData.IFields sysField = TheSystem.SystemData.Fields;
sysField.SetFieldType(ZOSAPI.SystemData.FieldType.ParaxialImageHeight);
System Explorer - Fields Data. This interface can be accessed via the ISystemData interface.
Definition: InterfacesSE.cs:819
void SetFieldType(FieldType type)
Sets the field type definition for all fields.

C++

// Define fields using Paraxial Image Height
ZOSAPI_Interfaces::IFieldsPtr sysField = TheSystem->SystemData->Fields;
sysField->SetFieldType(ZOSAPI_Interfaces::FieldType_ParaxialImageHeight);

Matlab

% Define fields using Paraxial Image Height
sysField = TheSystem.SystemData.Fields;
sysField.SetFieldType(ZOSAPI.SystemData.FieldType.ParaxialImageHeight);

Python

# Define fields using Paraxial Image Height
sysField = TheSystem.SystemData.Fields
sysField.SetFieldType(ZOSAPI.SystemData.FieldType.ParaxialImageHeight)
Parameters
typeThe new fields type.
Examples
CSharpStandalone_12_Seq_SystemExplorer.cs, and CSharpStandalone_15_Seq_Optimization.cs.

◆ SetVignetting()

void ZOSAPI.SystemData.IFields.SetVignetting ( )

Property Documentation

◆ Normalization

FieldNormalizationType ZOSAPI.SystemData.IFields.Normalization
getset

◆ NumberOfFields

int ZOSAPI.SystemData.IFields.NumberOfFields
get

Gets the number of fields currently defined in the system.

Usage (see Example 22 for a full sample)

C#

// Define batch ray trace constants
double hx = 0.0;
int max_wave = TheSystem.SystemData.Wavelengths.NumberOfWavelengths;
int num_fields = TheSystem.SystemData.Fields.NumberOfFields;
double[] hy_ary = new double[] { 0, 0.707, 1 };

C++

// Define batch ray trace constants
double hx = 0.0;
int max_wave = TheSystem->SystemData->Wavelengths->NumberOfWavelengths;
int num_fields = TheSystem->SystemData->Fields->NumberOfFields;
double hy_ary[] = { 0, 0.707, 1 };

Matlab

% define batch ray trace constants
hx = 0;
max_wave = TheSystem.SystemData.Wavelengths.NumberOfWavelengths;
hy_ary = [0, 0.707, 1];

Python

# Define batch ray trace constants
hx = 0.0
max_wave = TheSystem.SystemData.Wavelengths.NumberOfWavelengths
num_fields = TheSystem.SystemData.Fields.NumberOfFields
hy_ary = np.array([0, 0.707, 1])

The number of fields.

Connect with Ansys