Skip to main content

Zemax OpticStudio ZOS-API 2026 R1

Interface ZOSAPI::Analysis::Settings::IAS_

Last update: 13.03.2026

Definition:

Base class for all analysis settings interfaces. This class can be accessed via the IA_ 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()

Inherited by:

Members

Public functions

Function Verify

IMessages ZOSAPI.Analysis.Settings.IAS_.Verify()

Return type: IMessages

Function Save

void ZOSAPI.Analysis.Settings.IAS_.Save()

Saves the current settings to the default CFG file.

Return type: void

Function Load

void ZOSAPI.Analysis.Settings.IAS_.Load()

Loads settings from the default CFG file.

Return type: void

Function Reset

void ZOSAPI.Analysis.Settings.IAS_.Reset()

Resets the settings back to the defaults for the current analysis.

Return type: void

Reimplemented by:

Function SaveTo

bool ZOSAPI.Analysis.Settings.IAS_.SaveTo(string settingsFile)

Saves the current settings to the specified file.

Usage (see Example 17 for a full sample)

C#

            //Open a detector viewer
            analysis = TheSystem.Analyses.New_Analysis(AnalysisIDM.DetectorViewer);
            analysisSettings = analysis.GetSettings();
            cfgFile = System.IO.Path.GetTempFileName();
            analysisSettings.SaveTo(cfgFile);
            analysisSettings.ModifySettings(cfgFile, "DVW_SHOW", "2");
            analysisSettings.ModifySettings(cfgFile, "DVW_SMOOTHING", "1");
            analysisSettings.LoadFrom(cfgFile);
            System.IO.File.Delete(cfgFile);
            analysis.ApplyAndWaitForCompletion();

C++

    //Open a detector viewer
    analysis = TheSystem->Analyses->New_Analysis(AnalysisIDM_DetectorViewer);
    analysisSettings = analysis->GetSettings();
    tmpnam_s(cfgFile, L_tmpnam_s);
    analysisSettings->SaveTo(cfgFile);
    analysisSettings->ModifySettings(cfgFile, "DVW_SHOW", "2");
    analysisSettings->ModifySettings(cfgFile, "DVW_SMOOTHING", "1");
    analysisSettings->LoadFrom(cfgFile);
    remove(cfgFile);
    analysis->ApplyAndWaitForCompletion();

Matlab

    % Open a detector viewer
    det_analysis = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.DetectorViewer);
    det_analysisSettings = det_analysis.GetSettings();
    det_cfgFile = System.String.Concat(SamplesFolder, '\API\Matlab\e17_DetectorViewer.cfg');
    det_analysisSettings.SaveTo(det_cfgFile);
    det_analysisSettings.ModifySettings(det_cfgFile, 'DVW_SHOW', '2');
    det_analysisSettings.ModifySettings(det_cfgFile, 'DVW_SMOOTHING', '1');
    det_analysisSettings.LoadFrom(det_cfgFile);
    det_analysis.ApplyAndWaitForCompletion();

Python

    # Open a detector viewer
    det_analysis = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.DetectorViewer)
    det_analysisSettings = det_analysis.GetSettings()
    det_cfgFile = SamplesFolder + "\\API\\Python\\e17_DetectorViewer.cfg"
    det_analysisSettings.SaveTo(det_cfgFile)
    det_analysisSettings.ModifySettings(det_cfgFile, "DVW_SHOW", "2")
    det_analysisSettings.ModifySettings(det_cfgFile, "DVW_SMOOTHING", "1")
    det_analysisSettings.LoadFrom(det_cfgFile)
    det_analysis.ApplyAndWaitForCompletion()

Parameters:

  • settingsFile: The settings file.

Returns:

Parameters:

  • string settingsFile

Return type: bool

Function LoadFrom

bool ZOSAPI.Analysis.Settings.IAS_.LoadFrom(string settingsFile)

Replaces the current settings with settings read from the specified file.

Usage (see Example 17 for a full sample)

C#

            //Open a detector viewer
            analysis = TheSystem.Analyses.New_Analysis(AnalysisIDM.DetectorViewer);
            analysisSettings = analysis.GetSettings();
            cfgFile = System.IO.Path.GetTempFileName();
            analysisSettings.SaveTo(cfgFile);
            analysisSettings.ModifySettings(cfgFile, "DVW_SHOW", "2");
            analysisSettings.ModifySettings(cfgFile, "DVW_SMOOTHING", "1");
            analysisSettings.LoadFrom(cfgFile);
            System.IO.File.Delete(cfgFile);
            analysis.ApplyAndWaitForCompletion();

C++

    //Open a detector viewer
    analysis = TheSystem->Analyses->New_Analysis(AnalysisIDM_DetectorViewer);
    analysisSettings = analysis->GetSettings();
    tmpnam_s(cfgFile, L_tmpnam_s);
    analysisSettings->SaveTo(cfgFile);
    analysisSettings->ModifySettings(cfgFile, "DVW_SHOW", "2");
    analysisSettings->ModifySettings(cfgFile, "DVW_SMOOTHING", "1");
    analysisSettings->LoadFrom(cfgFile);
    remove(cfgFile);
    analysis->ApplyAndWaitForCompletion();

Matlab

    % Open a detector viewer
    det_analysis = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.DetectorViewer);
    det_analysisSettings = det_analysis.GetSettings();
    det_cfgFile = System.String.Concat(SamplesFolder, '\API\Matlab\e17_DetectorViewer.cfg');
    det_analysisSettings.SaveTo(det_cfgFile);
    det_analysisSettings.ModifySettings(det_cfgFile, 'DVW_SHOW', '2');
    det_analysisSettings.ModifySettings(det_cfgFile, 'DVW_SMOOTHING', '1');
    det_analysisSettings.LoadFrom(det_cfgFile);
    det_analysis.ApplyAndWaitForCompletion();

Python

    # Open a detector viewer
    det_analysis = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.DetectorViewer)
    det_analysisSettings = det_analysis.GetSettings()
    det_cfgFile = SamplesFolder + "\\API\\Python\\e17_DetectorViewer.cfg"
    det_analysisSettings.SaveTo(det_cfgFile)
    det_analysisSettings.ModifySettings(det_cfgFile, "DVW_SHOW", "2")
    det_analysisSettings.ModifySettings(det_cfgFile, "DVW_SMOOTHING", "1")
    det_analysisSettings.LoadFrom(det_cfgFile)
    det_analysis.ApplyAndWaitForCompletion()

Parameters:

  • settingsFile: The settings file.

Returns:

Parameters:

  • string settingsFile

Return type: bool

Function ModifySettings

bool ZOSAPI.Analysis.Settings.IAS_.ModifySettings(string settingsFile, string typeCode, string newValue)

Changes a single setting in the specified file. See the MODIFYSETTINGS DDE command help documentation for more information.

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

Parameters:

  • settingsFile: The settings file.
  • typeCode: The type code.
  • newValue: The new value.

Returns:

Parameters:

  • string settingsFile
  • string typeCode
  • string newValue

Return type: bool

Connect with Ansys