ZEMAX offers a built-in tolerancing feature which you may use to perform a complete and accurate tolerance analysis of your optical system.
Although ZEMAX performs the calculation of each tolerance “behind the scenes,” ZEMAX also gives you the option to view what it is doing more closely; the operation of the tolerance feature is not always transparent.
There are two different methods to saving the modifications that ZEMAX made to your lens file to calculate the change in criteria as a function of the specified tolerance(s).
The first option may be defined in the Tolerance Data Editor as a tolerance control operand. The SAVE tolerance control operand can be used after any tolerance you would like to inspect in more detail. For example, suppose that you had a tolerance operand TEDX (tolerance on element decenter in X) in the Tolerance Data Editor. After reviewing the resulting sensitivity analysis, the results did not appear to make sense.
As a result, you may edit the Tolerance Data Editor by adding a SAVE command after the TEDX operand. The next time the tolerance analysis is run, ZEMAX will save the file used to compute the TEDX tolerance, which you may view as a ZEMAX lens file.
![]() |
FILE: Single Element Lens.ZMX (attached to last page of article) |
TETX is the operand for tolerance on element tilt about the X axis. In this case, the single element has a tilt tolerance of +/- 0.5 degrees.
Running the tolerance with the following settings (note that Paraxial Focus is set as the compensator):
In the Sensitivity Analysis of the tolerance output, we can see the criteria value as well as the change in criteria as a function of our TETX tolerance. 
In this case, the tilt did not affect the RMS Spot Radius very much, but we can review what ZEMAX has done more closely by saving the file ZEMAX internally constructed to perform this perturbation.
In the Tolerance Data Editor, under the TETX line, insert a SAVE tolerance control operand.
The SAVE command allows you to save the previous tolerance to a ZEMAX Lens File with the specified “File #.” A file will be saved for both the maximum and minimum tolerance. The file names will be TSAV_MIN_xxxx.ZMX and TSAV_MAX_xxxx.ZMX for the min and max tolerance analysis, respectively, where xxxx is the integer number specified in the Int1 column. In this case, the integer number is 5, so the minimum tolerance file will be TSAV_MIN_0005.ZMX. Note that the saved file is saved into the same directory as the current lens file.
Run the tolerance analysis once more with the SAVE operand in place (use the same tolerance settings).
Once the analysis is complete, open the TSAV_MIN_0005.ZMX file from the appropriate directory. Note the modifications made to the Lens Data Editor. To tilt the element about the X axis, ZEMAX inserted a pair of Coordinate Break Surfaces with the appropriate solves and values. ZEMAX even places text in the Comment column to indicate which tolerance each surface represents. Also note the marginal ray height solve on surface 6. Remember, we chose to have Paraxial Focus as our compensator when performing the tolerance analysis!

With this capability, we can clearly review what ZEMAX has done to ensure any given tolerance is performed the way we expect. Most importantly, we can thoroughly investigate any tolerance which we find to produce curious results.
In the saved file, it is also possible to review the merit function which ZEMAX constructed to evaluate the RMS Spot Radius criteria. The Merit Function Value is equivalent to the criteria value reported in the tolerance output:

Much like the SAVE tolerance control operand (which is useful for evaluating one tolerance at a time), you may also save each individual Monte Carlo file generated during the tolerance analysis. This option exists in the Tolerancing dialog. In the top-most portion of the dialog, you may choose to specify how many Monte Carlo runs to perform as well as how many of these Monte Carlo files you would like to save for viewing after the analysis is complete. 
The benefits to saving the Monte Carlo files are the same to that of the SAVE tolerance control operand. However, the Monte Carlo analysis simulates the effect of all perturbations simultaneously. Thus, the saved files will contain the modified Lens Data Editor with possibly many changes/additions (depending upon the number of tolerance operands you have for your system).
Saved Monte Carlo files are also saved to the directory of the nominal lens file and any number of Monte Carlo files may be saved. The lens files are named MC_T000x.zmx, where x is the value 1 through the maximum number of specified Monte Carlo files to be saved.
In most cases, it isn’t necessary or desirable to review each individual saved Monte Carlo file. You may use the Monte Carlo Analysis output to help pick out any specific trial that you would like to later review in ZEMAX format: