How to measure the sag of an NSC object

This article describes how to measure the surface sag of a non-sequential object using the NSRA operand. 

Authored By Sanjay Gangadhara


Article Attachments


There are many situations in which it is necessary to know the surface sag of an object in Zemax. This information can be easily obtained in Sequential Mode using the SAGG operand or by clicking under the Analyze tab...Surface...Sag. In Non-Sequential Mode, things are more complex. Sequential surfaces are defined by a single equation referenced to a surface vertex, but non-sequential objects are three-dimensional objects which can be arbitrarily complex. Objects may be viewed using the Object Viewer, but sag data depends on the viewing point.

Measuring the surface sag with Universal Plot 2D

The surface sag of an object may be easily determined by the use of the NSRA operand. This operand can be used to determine the intersection point (along the local Z-axis) of a Source Ray with the object surface. By varying the coordinates of the Source Ray, the full surface of the object may be mapped out. As an example, we will measure the surface sag of a Compound Parabolic Concentrator (CPC). Open the file “NSC_Sag_CPC.zmx,” which is provided in the Article Attachments link. You should observe that the Non-Sequential Component Editor contains two objects with the following parameters:

Object 1 – Source Ray

  • (x,y,z) positions: (0,0,0)
  • # of Layout Rays: 1
  • # of Analysis Rays: 1
    • It is necessary when using the NSRA operand to make sure that the # of Analysis Rays is set to 1
  • Defaults are used for all other values

Object 2 – CPC

  • (x,y,z) positions: (0,0,0.5)
  • Tilt about X = 15.0
  • Tilt about Y = 15.0
  • Radial Aperture = 0.10
  • Angle (deg) = 10.0
  • Length = 5.0
  • Defaults are used for all other values

Go to the Analyze tab...Universal Plot...2-D...New. You will have access to settings as shown below:

universal plot 2d

The X-axis will be the X-position of object 1 in the NSC editor–the Source Ray. This position will be varied from -1 to 2 in 50 steps. Similarly, the Y-axis will be the Y-position of the Source Ray, varied from -2 to 1 in 50 steps. The Z-axis is defined by the NSRA operand. The inputs to this operand are:

  • Surf: The surface number of the non-sequential group. For a system in pure Non-Sequential Mode, this is always 1.
  • Src#: The object number of the desired source (in our case the Source Ray--object 1).
  • Splt?: Specifies if ray splitting is on (0 means no ray splitting).
  • Pol?: Specifies if polarization effects are included in the analysis (0 means that they are not).
  • Seg#: Specifies the segment number of the ray for which data is calculated. Segment 0 is the launched ray, Segment 1 is the ray after its first interaction, Segment 2 is the ray after its second interaction, etc. In our case, we are interested in the intersection point between the ray and the object. Since this object is the first surface that the ray interacts with, we specify Seg# = 1.
  • Data: Specifies which data are to be calculated for the given ray segment. Data = 3 corresponds to the Z-coordinate of the ray (see Chapter 14 of the Zemax manual for more details).

Hit OK. A false color map will appear which shows the Z-coordinate of the CPC as a function of X and Y:

universal plot

To generate this plot, the X- and Y-coordinates of the Source Ray were varied from -1 to 2 and -2 to 1, respectively, and the corresponding z-coordinate was determined from the intersection point of the ray with the surface of the CPC. By clicking on the Text button in the window, a listing of the various Z values can be obtained:

universal plot

For objects in which the sag needs to be determined for different orientations, the object may be tilted about the X, Y, and Z axes and the procedure repeated.

Measuring the surface sag with a ZPL macro

Calculations for the surface sag may be automated with the use of a simple ZPL macro (a copy of which is also avaiable for download via the Article Attachments):


In this macro, you will be asked to enter both the X- and Y-range for the Source Ray and the number of steps over which that range is covered, just as you would have in the Universal Plot 2D Settings dialog box. The X- and Y-position of the Source Ray is then varied within the specified ranges using the keyword SETNSCPOSITION. Once the Source Ray has been positioned for each step, the Z-coordinate of the ray intercept on the object surface is determined using the NSRA operand, which in the macro is called by using the OCOD and OPEV operands. The initial position of the Source Ray is determined using the NPOS operand, and before the macro is terminated, the Source Ray is set back to this initial position. Details about the keyword SETNSCPOSITION and the functions OCOD, OPEV, and NPOS can be found in Chapter 22 of the Zemax manual. The output generated by this macro is a table of X, Y, and Z values for the various source ray positions:

text viewer


Was this article helpful?
2 out of 2 found this helpful



Please sign in to leave a comment.