Occasionally, you might need to take measured sag data and fit a surface in CODE V to this data. The data could be profilometer data from a fabricated part to look for fab errors, or data from a cockpit or automotive windshield that does not have a typical surface profile. Recently a set of macros has been improved to aid you in using CODE V for this task.
The process is pretty simple and utilizes the flexibility of the CODE V optimizer. A dummy system is set up as shown below for the purpose of measuring the optical path between a reference surface and a fitting surface. A custom user defined error function is created that defines the distance (using OP) between the surfaces at many different heights as aberrations. The target values for these aberrations are set to match the sag values from a data file, so that when optimized, the fitted surface should match the sag data (given sufficient degrees of freedom).