Interface ZOSAPI::Analysis::IA_
Last update: 13.03.2026
Definition:
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
analysis.ApplyAndWaitForCompletion();
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();
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()
Members
- AnalysisType
- Apply
- ApplyAndWaitForCompletion
- Close
- GetAnalysisName
- GetResults
- GetSettings
- HasAnalysisSpecificSettings
- IsRunning
- Release
- StatusMessages
- Terminate
- Title
- ToFile
- WaitForCompletion
Properties
Property Title
Definition:
String ZOSAPI.Analysis.IA_.Title
Return type: String
Property GetAnalysisName
Definition:
String ZOSAPI.Analysis.IA_.GetAnalysisName
Return type: String
Property AnalysisType
Definition:
AnalysisIDM ZOSAPI.Analysis.IA_.AnalysisType
Return type: AnalysisIDM
Property StatusMessages
Definition:
IMessages ZOSAPI.Analysis.IA_.StatusMessages
Return type: IMessages
Property HasAnalysisSpecificSettings
Definition:
bool ZOSAPI.Analysis.IA_.HasAnalysisSpecificSettings
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;
newSpot.ApplyAndWaitForCompletion();
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.
Return type: bool
Public functions
Function 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
analysis.ApplyAndWaitForCompletion();
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:
Return type: IAS_
Function GetResults
IAR_ ZOSAPI.Analysis.IA_.GetResults()
Gets the result data (if available) for the current analysis.
Returns:
Return type: IAR_
Function IsRunning
bool ZOSAPI.Analysis.IA_.IsRunning()
Determines whether this analysis is currently updating.
Returns:
Return type: bool
Function Apply
IMessage ZOSAPI.Analysis.IA_.Apply()
Use the current settings values to re-run the analysis.
Returns:
Return type: IMessage
Function 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;
newSpot.ApplyAndWaitForCompletion();
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:
Return type: IMessage
Function Terminate
bool ZOSAPI.Analysis.IA_.Terminate()
Attempt to cancel the currently running the analysis.
Returns:
Return type: bool
Function WaitForCompletion
void ZOSAPI.Analysis.IA_.WaitForCompletion()
Waits for the current analysis to finish running (if applicable).
Return type: void
Function Close
void ZOSAPI.Analysis.IA_.Close()
Closes this analysis; note that it will be removed from the system permanently.
Return type: void
Function 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.
Return type: void
Function ToFile
void ZOSAPI.Analysis.IA_.ToFile(String Filename, bool showSettings=false, bool verify=false)
Parameters:
- String Filename
- bool showSettings = false
- bool verify = false
Return type: void