There are a number of different file types which are used by OpticStudio, but perhaps the most commonly misunderstood are the configuration files (.CFG) and session (.ZDA) files. Each serve a specific purpose and will be explained in detail in the following article.
Authored By Dan Hill
The .ZDA files are OpticStudio “session” files, which define the display configuration and open windows and settings for each saved lens file (.ZMX).
The .CFG files are configuration files. "OpticStudio.CFG" is the main configuration file which describes the user-selected options on the environment dialog box. There are numerous other files that may be present which end in CFG - such as RAY.CFG - which, when generated, contains the user-defined defaults for the ray fan plot.
This article provides an overview of each of these files types.
The .ZDA file extension, or the “session” file, are those which define the display configuration and opened windows and settings for each saved .ZMX lens file. By default, whenever you save your lens file, OpticStudio also creates a session file with the same filename as the lens file, using a different extension: .ZDA. Then, the next time the lens file is opened, all the analysis windows and editors appear in the exact same location as they were when the file was saved. In addition, the session files contain the settings information for each of these open analysis windows, so the designer may better recall the analysis which was being performed upon last saving the file.
The use and creation of session files may be turned on or off in OpticStudio Project Preferences:
If this option is unchecked, then no session file is created upon saving the lens file. In addition, even if a previously saved lens file has an associating session file, none of the analysis windows will be recalled.
When sending a colleague/customer your lens file, it is often useful to send the session file as well. This is especially true when sending your file for review to Zemax support. By sending your session file along with your OpticStudio file, our support staff can immediately assess the question at hand and review the appropriate analyses without having to ask for specific settings information.
Throughout the Zemax Knowledgebase articles, sample files are included for download. Often times, the .ZMX and .ZDA files are included. As long as both files reside in the same directory, then upon opening the lens file, the appropriate analysis windows will also be displayed.
The session files used to have the extension SES. The .SES file is now obsolete. The new .ZDA session files also enable opened analysis data storage, so that you don’t have to re-run a ray trace every time you open the file.
In addition to the lens and session files are the configuration files. Configuration files serve a different, unique purpose from that of the lens and session files. In the settings window of nearly every analysis feature in OpticStudio, there exists a “SAVE” button.
Clicking this button will execute the analysis, but will also save the settings chosen to a configuration file, or .CFG file. The configuration files are ones which describe the user-selected options for analysis windows and other settings from within OpticStudio. The configuration file “remembers” the saved settings, so that the next time you open a new analysis window of the same type, the saved settings will be used as the defaults.
If the SAVE button is used at any time while working on a lens file, OpticStudio will construct a configuration file which is specific to that lens file. In addition, these settings will be saved globally, either to the "OpticStudio.CFG" (discussed in more detail later) or its own configuration file in the main Zemax directory.
As an example, assume you make some modifications to the Spot Diagram settings, and press the SAVE button. If one does not already exist, OpticStudio will construct a .CFG file specific to your lens file. Now, each time you open a new Spot Diagram window from within the same lens file, those saved settings will be used.
In addition, OpticStudio also creates a SPT.CFG located in your main Zemax directory:
It is this configuration file which controls the global default settings for the Spot Diagram. So, if within a different lens file, you open the Spot Diagram, the last set of saved settings will be used for that feature. That is, of course, if the lens file does not have its own specific configuration file associated with it!
So, it works like this. Any time a new analysis feature is opened, OpticStudio checks to see if there is a .CFG file with the same name as the lens file located in the same directory. If so, then it checks to see if that configuration file contains any saved information which is specific to the analysis feature chosen.
If so, then the settings information stored in this local configuration file are used. If not, OpticStudio will then check the global configuration file for that analysis feature and use this information if available. If there is not a configuration file specific to that analysis feature, then the original OpticStudio defaults are used for the settings of the chosen analysis.
The "OpticStudio.CFG" file, located in the main Zemax directory, serves as the main configuration file which describes the user-selected options on the environment dialog box, or the File...Preferences dialog. Any user-preferences which are applied using this dialog are saved to this configuration file. It is important to note that this configuration file, or any other configuration file, is NOT overwritten by OpticStudio upon a new installation. Therefore, you may install newer updates of OpticStudio on top of the existing version on your computer without affecting any of your preferences, whether they be color assignments, button bar arrangements, or saved settings within the analysis features themselves.
Configuration files are also vital to the way some optimization operands work. Some operands, such as IMAE and POPD, use the saved settings (from the lens-specific configuration file or the last globally saved settings) to perform a calculation. The main reason for this is because these complex analysis features require many different setting options, not all of which can be presented in the Merit Function Editor. Therefore, in order to properly use these operands, the corresponding analysis feature must first be opened, and have the settings modified and saved by pressing the SAVE button.
In addition to optimization operands, some ZPL keywords rely on the use of the configuration files. For example, the GETTEXTFILE keyword (which creates an ASCII text file from any OpticStudio analysis window which supports text) calls for a “settingsfilename.” The settingsfilename is the configuration file which OpticStudio will use for the default settings of the desired analysis feature. For more details, please refer to the discussion of the GETTEXTFILE keyword in the Zemax Programming Language Help File.