Skip to main content

ZOS-API interface 2024 R2 SP02

ZOSAPI.Analysis.IA_ Interface Reference

Last update: 17.07.2025

Base interface for all analysis windows. This interface can be accessed via the I_Analyses interface. More...

Public Member Functions

IAS_ GetSettings ()
 Gets the settings for the current analysis.
 
IAR_ GetResults ()
 Gets the result data (if available) for the current analysis.
 
bool IsRunning ()
 Determines whether this analysis is currently updating.
 
IMessage Apply ()
 Use the current settings values to re-run the analysis.
 
IMessage ApplyAndWaitForCompletion ()
 Re-runs the analysis with the current settings and waits for it to finish calculating.
 
bool Terminate ()
 Attempt to cancel the currently running the analysis.
 
void WaitForCompletion ()
 Waits for the current analysis to finish running (if applicable).
 
void Close ()
 Closes this analysis; note that it will be removed from the system permanently.
 
void Release ()
 Disconnect this object from the interface, freeing up any memory in use. Note that unlike Close, this method does not remove the analysis from the current system.
 
void ToFile (String Filename, bool showSettings=false, bool verify=false)
 

Properties

String Title [get]
 
String GetAnalysisName [get]
 
AnalysisIDM AnalysisType [get]
 
IMessages StatusMessages [get]
 
bool HasAnalysisSpecificSettings [get]
 Gets a value indicating whether this instance has a fully-implemented settings interface available. If false, the analysis settings can only be changed via IAS_.ModifySettings.
 

Detailed Description

Base interface for all analysis windows. This interface can be accessed via the I_Analyses interface.

Usage (see Example 15 for a full sample)

C#

//Open a shaded model
IA_ analysis = TheSystem.Analyses.New_Analysis(AnalysisIDM.ShadedModel);
analysis.Terminate();
analysis.WaitForCompletion();
IAS_ analysisSettings = analysis.GetSettings();
string cfgFile = System.IO.Path.GetTempFileName();
// Save the current settings to the temp file
analysisSettings.SaveTo(cfgFile);
// make your modifications to it
//MODIFYSETTINGS are defined in the ZPL help files: The Programming Tab > About the ZPL > Keywords
analysisSettings.ModifySettings(cfgFile, "SHA_ROTX", "90");
analysisSettings.ModifySettings(cfgFile, "SHA_ROTY", "0");
analysisSettings.ModifySettings(cfgFile, "SHA_ROTZ", "0");
// now load in the modified settings
analysisSettings.LoadFrom(cfgFile);
// If you want to overwrite your default CFG, copy it after you are done modifying the settings:
//string CFG_fullname = System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\Documents\\Zemax\\Configs\\Configs\\POP.CFG";
//System.IO.File.Copy(cfgFile, CFG_fullname, true);
// We don't need the temp file any more, so delete it
System.IO.File.Delete(cfgFile);
// Run the analysis with the new settings
Base interface for all analysis windows. This interface can be accessed via the I_Analyses interface.
Definition: IA_Base.cs:29
bool Terminate()
Attempt to cancel the currently running the analysis.
void WaitForCompletion()
Waits for the current analysis to finish running (if applicable).
IAS_ GetSettings()
Gets the settings for the current analysis.
IMessage ApplyAndWaitForCompletion()
Re-runs the analysis with the current settings and waits for it to finish calculating.
Base class for all analysis settings interfaces. This class can be accessed via the IA_ interface.
Definition: IAS_Base.cs:25
AnalysisIDM
All available analysis types. See the I_Analyses interface for more information.
Definition: I_Analyses.cs:15

C++

// Open a shaded model
IA_Ptr analysis = TheSystem->Analyses->New_Analysis(AnalysisIDM::AnalysisIDM_ShadedModel);
analysis->Terminate();
analysis->WaitForCompletion();
IAS_Ptr settings = analysis->GetSettings();
//need to use - #pragma warning(disable:4996)
char* pUserprofile = getenv("Temp");
_bstr_t cfgFile = _bstr_t(pUserprofile) + "\\sha.cfg";
// Save the current settings to the temp file
settings->SaveTo(cfgFile);
// make your modifications to it
// MODIFYSETTINGS are defined in the ZPL help files : The Programming Tab > About the ZPL > Keywords
settings->ModifySettings(cfgFile, "SHA_ROTX", "90");
settings->ModifySettings(cfgFile, "SHA_ROTY", "0");
settings->ModifySettings(cfgFile, "SHA_ROTZ", "0");
// now load in the modified settings
settings->LoadFrom(cfgFile);
// If you want to overwrite your default CFG, copy it after you are done modifying the settings :
//_bstr_t CFG_fullname = _bstr_t(getenv("USERPROFILE")) + "\\Documents\\Zemax\\Configs\\POP.CFG";
// copyfile(cfgFile, CFG_fullname) // generic psuedo code
// We don't need the temp file any more, so delete it
std::remove(cfgFile);
// Run the analysis with the new settings
analysis->ApplyAndWaitForCompletion();

Matlab

%Open a shaded model
analysis = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.ShadedModel);
analysis.Terminate();
analysis.WaitForCompletion();
analysisSettings = analysis.GetSettings();
cfgFile = System.IO.Path.GetTempFileName();
% Save the current settings to the temp file
analysisSettings.SaveTo(cfgFile);
% make your modifications to it
%MODIFYSETTINGS are defined in the ZPL help files: The Programming Tab > About the ZPL > Keywords
analysisSettings.ModifySettings(cfgFile, 'SHA_ROTX', '90');
analysisSettings.ModifySettings(cfgFile, 'SHA_ROTY', '0');
analysisSettings.ModifySettings(cfgFile, 'SHA_ROTZ', '0');
% now load in the modified settings
analysisSettings.LoadFrom(cfgFile);
% If you want to overwrite your default CFG, copy it after you are done modifying the settings:
%string CFG_fullname = System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\Configs\\POP.CFG";
%System.IO.File.Copy(cfgFile, CFG_fullname, true);
% We don't need the temp file any more, so delete it
System.IO.File.Delete(cfgFile);
% Run the analysis with the new settings
analysis.ApplyAndWaitForCompletion();
Definition: IAS_FieldCurvatureAndDistortion.cs:5
The ZOSAPI namespace contains classes for initially connecting to zemax. See also ZOSAPI_Connection,...
Definition: IAS_FieldCurvatureAndDistortion.cs:5

Python

# Open a shaded model
analysis = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.ShadedModel)
analysis.Terminate()
analysis.WaitForCompletion()
analysisSettings = analysis.GetSettings()
cfgFile = os.environ.get('Temp') + '\\sha.cfg'
# Save the current settings to the temp file
analysisSettings.SaveTo(cfgFile)
# make your modifications to it
# MODIFYSETTINGS are defined in the ZPL help files: The Programming Tab > About the ZPL > Keywords
analysisSettings.ModifySettings(cfgFile, 'SHA_ROTX', '90')
analysisSettings.ModifySettings(cfgFile, 'SHA_ROTY', '0')
analysisSettings.ModifySettings(cfgFile, 'SHA_ROTZ', '0')
# now load in the modified settings
analysisSettings.LoadFrom(cfgFile)
# If you want to overwrite your default CFG, copy it after you are done modifying the settings:
# CFG_fullname = os.environ.get('USERPROFILE') + '\\Documents\\Zemax\\Configs\\POP.CFG'
# copyfile(cfgFile, CFG_fullname)
# We don't need the temp file any more, so delete it
if os.path.exists(cfgFile):
os.remove(cfgFile)
# Run the analysis with the new settings
analysis.ApplyAndWaitForCompletion()
Examples
CSharpStandalone_04_pull_data_from_FFTMTF.cs, CSharpStandalone_10_NSC_ZRD_filter_string.cs, CSharpStandalone_11_Basic_Seq.cs, CSharpStandalone_15_Seq_Optimization.cs, CSharpStandalone_17_NSC_BulkScatter.cs, CSharpStandalone_21_White_LED_Phosphor.cs, CSharpStandalone_22_seq_spot_diagram.cs, CSharpStandalone_23_ray_fan_native_manual_comparison.cs, CSharpStandalone_24_nsc_detectors.cs, and CSharpStandalone_25_source_spectrum_diffraction_grating.cs.

Member Function Documentation

◆ Apply()

IMessage ZOSAPI.Analysis.IA_.Apply ( )

Use the current settings values to re-run the analysis.

Returns

◆ ApplyAndWaitForCompletion()

IMessage ZOSAPI.Analysis.IA_.ApplyAndWaitForCompletion ( )

Re-runs the analysis with the current settings and waits for it to finish calculating.

Usage (see Example 11 for a full sample)

C#

// Open Spot Diagram to See Result!
IA_ newSpot = TheSystem.Analyses.New_StandardSpot();
Console.WriteLine("Spot has analysis specific settings? " + newSpot.HasAnalysisSpecificSettings.ToString()); // True; no ModifySettings
IAS_Spot spotSet = newSpot.GetSettings() as IAS_Spot;
spotSet.RayDensity = 15;
bool HasAnalysisSpecificSettings
Gets a value indicating whether this instance has a fully-implemented settings interface available....
Definition: IA_Base.cs:55

C++

// Open Spot Diagram to See Result!
IA_Ptr newSpot = TheSystem->Analyses->New_StandardSpot();
cout << "Spot has analysis specific settings? " << newSpot->HasAnalysisSpecificSettings << endl; // True; no ModifySettings
IAS_SpotPtr spotSet = newSpot->GetSettings();
spotSet->RayDensity = 15;
newSpot->ApplyAndWaitForCompletion();

Matlab

% Open Spot Diagram to See Result!
newSpot = TheSystem.Analyses.New_StandardSpot();
fprintf('Spot has analysis specific settings? %i\n', newSpot.HasAnalysisSpecificSettings); % True; no ModifySettings
%Console.WriteLine("Spot has analysis specific settings? " + newSpot.HasAnalysisSpecificSettings.ToString()); //
spotSet = newSpot.GetSettings();
spotSet.RayDensity = 15;
newSpot.ApplyAndWaitForCompletion();

Python

# Open Spot Diagram to See Result!
newSpot = TheSystem.Analyses.New_StandardSpot()
print("Spot has analysis specific settings? ", newSpot.HasAnalysisSpecificSettings) # True; no ModifySettings
newSettings = newSpot.GetSettings()
newSettings.RayDensity = 15
newSpot.ApplyAndWaitForCompletion()
Returns
Examples
CSharpStandalone_04_pull_data_from_FFTMTF.cs, CSharpStandalone_10_NSC_ZRD_filter_string.cs, CSharpStandalone_11_Basic_Seq.cs, CSharpStandalone_15_Seq_Optimization.cs, CSharpStandalone_17_NSC_BulkScatter.cs, CSharpStandalone_21_White_LED_Phosphor.cs, CSharpStandalone_22_seq_spot_diagram.cs, CSharpStandalone_23_ray_fan_native_manual_comparison.cs, CSharpStandalone_24_nsc_detectors.cs, and CSharpStandalone_25_source_spectrum_diffraction_grating.cs.

◆ Close()

void ZOSAPI.Analysis.IA_.Close ( )

Closes this analysis; note that it will be removed from the system permanently.

◆ GetResults()

◆ GetSettings()

IAS_ ZOSAPI.Analysis.IA_.GetSettings ( )

Gets the settings for the current analysis.

Usage (see Example 17 for a full sample)

C#

//Open a shaded model
IA_ analysis = TheSystem.Analyses.New_Analysis(AnalysisIDM.NSCShadedModel);
analysis.Terminate();
analysis.WaitForCompletion();
IAS_ analysisSettings = analysis.GetSettings();
string cfgFile = System.IO.Path.GetTempFileName();
// Save the current settings to the temp file
analysisSettings.SaveTo(cfgFile);
// make your modifications to it
//MODIFYSETTINGS are defined in the ZPL help files: The Programming Tab > About the ZPL > Keywords
analysisSettings.ModifySettings(cfgFile, "SHA_ROTX", "20");
analysisSettings.ModifySettings(cfgFile, "SHA_ROTY", "-20");
analysisSettings.ModifySettings(cfgFile, "SHA_ROTZ", "30");
// now load in the modified settings
analysisSettings.LoadFrom(cfgFile);
// If you want to overwrite your default CFG, copy it after you are done modifying the settings:
//string CFG_fullname = "\\zmedc02\\users\\sandrine.auriol\\Documents\\Zemax\\Configs\\POP.CFG";
//System.IO.File.Copy(cfgFile, CFG_fullname, true);
// We don't need the temp file any more, so delete it
System.IO.File.Delete(cfgFile);
// Run the analysis with the new settings

C++

//Open a shaded model
IA_Ptr analysis = TheSystem->Analyses->New_Analysis(AnalysisIDM_NSCShadedModel);
analysis->Terminate();
analysis->WaitForCompletion();
IAS_Ptr analysisSettings = analysis->GetSettings();
char cfgFile[L_tmpnam_s];
tmpnam_s(cfgFile, L_tmpnam_s);
// Save the current settings to the temp file
analysisSettings->SaveTo(cfgFile);
// make your modifications to it
// MODIFYSETTINGS are defined in the ZPL help files: The Programming Tab > About the ZPL > Keywords
analysisSettings->ModifySettings(cfgFile, "SHA_ROTX", "20");
analysisSettings->ModifySettings(cfgFile, "SHA_ROTY", "-20");
analysisSettings->ModifySettings(cfgFile, "SHA_ROTZ", "30");
// now load in the modified settings
analysisSettings->LoadFrom(cfgFile);
// We don't need the temp file any more, so delete it
remove(cfgFile);
// Run the analysis with the new settings
analysis->ApplyAndWaitForCompletion();

Matlab

% Open a shaded model
analysis = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.NSCShadedModel);
analysis.WaitForCompletion();
analysisSettings = analysis.GetSettings();
cfgFile = char(System.String.Concat(SamplesFolder, '\API\Matlab\e17_NSC_BulkScatter.cfg'));
analysisSettings.SaveTo(cfgFile); % Save current settings to a cfg file
% MODIFYSETTINGS are defined in ZPL help files: The Programming Tab > About the ZPL > Keywords
% need to manually turn on SCATTERING in shaded model to see bulk scattering
analysisSettings.ModifySettings(cfgFile, 'SHA_ROTX', '20');
analysisSettings.ModifySettings(cfgFile, 'SHA_ROTY', '-20');
analysisSettings.ModifySettings(cfgFile, 'SHA_ROTZ', '30');
analysisSettings.LoadFrom(cfgFile); % Load in the newly modified settings
% If you want to overwrite your default CFG, save over it with newly modified CFG file:
% CFG_fullname = System.String.Concat(getenv('Temp'), '\Documents\Zemax\Configs\LSN.CFG');
% copyfile(char(cfgFile), char(CFG_fullname));
analysis.ApplyAndWaitForCompletion(); % Run analysis

Python

# Open a shaded model
analysis = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.NSCShadedModel)
analysis.WaitForCompletion()
analysisSettings = analysis.GetSettings()
cfgFile = SamplesFolder + "\\API\\Python\\e17_NSC_BulkScatter.cfg"
analysisSettings.SaveTo(cfgFile) # Save current settings to a cfg file
# MODIFYSETTINGS are defined in ZPL help files: The Programming Tab > About the ZPL > Keywords
analysisSettings.ModifySettings(cfgFile, "SHA_ROTX", "20")
analysisSettings.ModifySettings(cfgFile, "SHA_ROTY", "-20")
analysisSettings.ModifySettings(cfgFile, "SHA_ROTZ", "30")
analysisSettings.LoadFrom(cfgFile) # Load in the newly modified settings
# If you want to overwrite your default CFG, save over it with newly modified CFG file:
# CFG_fullname = "C:\\Users\\zachary.Derocher\\Documents\\Zemax\\Configs\\POP.CFG"
# import shutil
# shutil.copy(cfgFile, CFG_fullname)
analysis.ApplyAndWaitForCompletion() # Run analysis
Returns
Examples
CSharpStandalone_04_pull_data_from_FFTMTF.cs, CSharpStandalone_10_NSC_ZRD_filter_string.cs, CSharpStandalone_11_Basic_Seq.cs, CSharpStandalone_15_Seq_Optimization.cs, CSharpStandalone_17_NSC_BulkScatter.cs, CSharpStandalone_21_White_LED_Phosphor.cs, CSharpStandalone_22_seq_spot_diagram.cs, CSharpStandalone_23_ray_fan_native_manual_comparison.cs, CSharpStandalone_24_nsc_detectors.cs, and CSharpStandalone_25_source_spectrum_diffraction_grating.cs.

◆ IsRunning()

bool ZOSAPI.Analysis.IA_.IsRunning ( )

Determines whether this analysis is currently updating.

Returns

◆ Release()

void ZOSAPI.Analysis.IA_.Release ( )

Disconnect this object from the interface, freeing up any memory in use. Note that unlike Close, this method does not remove the analysis from the current system.

◆ Terminate()

bool ZOSAPI.Analysis.IA_.Terminate ( )

Attempt to cancel the currently running the analysis.

Returns
Examples
CSharpStandalone_15_Seq_Optimization.cs, and CSharpStandalone_17_NSC_BulkScatter.cs.

◆ ToFile()

void ZOSAPI.Analysis.IA_.ToFile ( String  Filename,
bool  showSettings = false,
bool  verify = false 
)

◆ WaitForCompletion()

void ZOSAPI.Analysis.IA_.WaitForCompletion ( )

Waits for the current analysis to finish running (if applicable).

Examples
CSharpStandalone_15_Seq_Optimization.cs, and CSharpStandalone_17_NSC_BulkScatter.cs.

Property Documentation

◆ AnalysisType

AnalysisIDM ZOSAPI.Analysis.IA_.AnalysisType
get

◆ GetAnalysisName

String ZOSAPI.Analysis.IA_.GetAnalysisName
get

◆ HasAnalysisSpecificSettings

bool ZOSAPI.Analysis.IA_.HasAnalysisSpecificSettings
get

Gets a value indicating whether this instance has a fully-implemented settings interface available. If false, the analysis settings can only be changed via IAS_.ModifySettings.

Usage (see Example 11 for a full sample)

C#

// Open Spot Diagram to See Result!
IA_ newSpot = TheSystem.Analyses.New_StandardSpot();
Console.WriteLine("Spot has analysis specific settings? " + newSpot.HasAnalysisSpecificSettings.ToString()); // True; no ModifySettings
IAS_Spot spotSet = newSpot.GetSettings() as IAS_Spot;
spotSet.RayDensity = 15;

C++

// Open Spot Diagram to See Result!
IA_Ptr newSpot = TheSystem->Analyses->New_StandardSpot();
cout << "Spot has analysis specific settings? " << newSpot->HasAnalysisSpecificSettings << endl; // True; no ModifySettings
IAS_SpotPtr spotSet = newSpot->GetSettings();
spotSet->RayDensity = 15;
newSpot->ApplyAndWaitForCompletion();

Matlab

% Open Spot Diagram to See Result!
newSpot = TheSystem.Analyses.New_StandardSpot();
fprintf('Spot has analysis specific settings? %i\n', newSpot.HasAnalysisSpecificSettings); % True; no ModifySettings
%Console.WriteLine("Spot has analysis specific settings? " + newSpot.HasAnalysisSpecificSettings.ToString()); //
spotSet = newSpot.GetSettings();
spotSet.RayDensity = 15;
newSpot.ApplyAndWaitForCompletion();

Python

# Open Spot Diagram to See Result!
newSpot = TheSystem.Analyses.New_StandardSpot()
print("Spot has analysis specific settings? ", newSpot.HasAnalysisSpecificSettings) # True; no ModifySettings
newSettings = newSpot.GetSettings()
newSettings.RayDensity = 15
newSpot.ApplyAndWaitForCompletion()

true if this instance has analysis specific settings; otherwise, false.

Examples
CSharpStandalone_11_Basic_Seq.cs.

◆ StatusMessages

IMessages ZOSAPI.Analysis.IA_.StatusMessages
get

◆ Title

String ZOSAPI.Analysis.IA_.Title
get

Connect with Ansys