NSC Sag Map Tool Usage

This article explains how to measure and display the sag of an object in Non-Sequential Mode using the NSC Sag tool. Learn about the basics of this capability, including how to set up a file with a complex CAD part to get the sag values for a specific face.

Authored By Michael Humphreys and Kevin Scales


Article Downloads


Sequential Mode in OpticStudio has the Surface Sag analysis feature which displays the sag, or change in z-position, of a surface from the local vertex as a function of x- and y-positions on the surface. Although a User Analysis has been included in Non-Sequential mode as an API-built application for this purpose, there was, prior to Release 23.1, no built-in analysis tool to provide the same functionality. This article will show how to use the NSC Sag tool, found in the Polarization and Surface Physics group on the Analyze tab, to calculate the surface sag for non-sequential objects. It will also discuss the internal calculations and discuss use of the earlier similar application, which continues to be included with OpticStudio.

Running NSC Sag

The NSC Sag tool is found in the Analyze tab as part of the Polarization and Surface Physics group.


The first time the analysis is launched, click on Settings to input needed information. The initial window will not be set up correctly:


The Settings window has the following sections (all length values are in lens units):


Sampling – number of data points (33, 65, 129, 257, 513, 1025, 2049, 4097).

Object – only valid objects (non-source and non-detector) are listed.

Data – only Surface Sag is supported at this time.

Face – once a valid object is selected, only the actual object’s faces are listed.

Show As – data type to display (False Color, Text, or Cross Section)

Remove – takes away certain measured sag quantities from the display. Possible options are base radius, best fit sphere, average sag, and minimum sag. Not all options are available for all objects and faces.

Layout Mode – displays either full rays or ray points when viewing the layout plot.

Width – width of array of rays.

Offset – constant value added/subtracted from all Z values during calculation.

Decenter X/Y – center of array of rays

Rotation – Z-axis rotation of object (values should be between 0° and 360°).

Keep Object Tilts (checkbox) – Preserves original X,Y tilts of object from component editor.

X/Y Decenter – center of array of rays.

Advanced – exposes advanced settings:

Probe Ray Offset – Z starting position of array of rays.

Keep ZRD File (checkbox) – Saves intermediate ZRD file.

Buttons – OK runs the analysis and Cancel closes settings without performing calculations. Settings can be saved, loaded, or reset.

Measuring a CAD File

The NSC Sag tool can measure the sag on any non-sequential object, including CAD parts. For native OpticStudio objects, which are centered on the object’s local vertex, the User Analysis should work without much setup by the user. However, for imported CAD parts including STEP and SLDPRT files, which could have an offset and rotation for the center of the part with respect to the local vertex, some setup could be required.

The first thing to determine is which face to run the analysis on. To determine the face number, click on View Current Object in the Non-Sequential Editor toolbar. This will open an interactive viewer where the desired face can be clicked. The face will turn orange. The highlighted face number will appear in the viewer’s tab:


Next we need to find out where the probing rays should aim. CAD objects may not be centered or aligned as expected or desired. To see the problem, open the file nsc_sag_random_curve_initial.zmx. We can see that the initial orientation of a single ray centered along the Z axis hits the object far to one side, and that the face we want is tilted back far more than we would like:


If the ray were currently centered on the CAD part, no modification would be required, but that is not the case here, so we want to change the Tilt About X/Y of the CAD Part and the X/Y/Z Position of the ray. The easiest way to quickly change the tilt of the CAD part is to set Tilt About X (or in some cases, also Y and Z) as variables in the editor and launch Optimization...Visual Optimization. Change the Start and Stop values for all tilts to -180 and +180 respectively. Now modify the values until the CAD part is aligned with the Source Ray. Make sure to click Keep and Exit once the part is rotated:


For the sample file, the Tilt About X of the RandomCurve.STEP should become -79.2 while the tilts about Y and Z can remain at 0.0 without modification. If -79.2 seems oddly specific, note that when you use the range of -180 to +180 for the tilts and use the slider bar, OpticStudio changes the tilt in fixed increments for fifty total steps, which comes out to 7.2 degree increments, and one of the values happens to be -79.2, visually appearing to be what we are looking for. We can, if we wish, select a different value here, but -79.2 will be used in the accompanying figures.

In the figure above, we can see the Source Point outlined in red, but no ray is visible. In this case, the desired orientation for viewing rotates the object up far enough that the ray does not intersect it. We will need to change the position of the source as well. We can use the Visual Optimizer for this too, but it is probably easier to just use the Active Cursor in a Layout plot with the Camera View orientation along X and Y.


From this visual survey, we can decide the X and Y positions should be 225 and 475 respectively. Similarly, if we orient our view to Y and Z, we will note that the -10mm Z position in the Sag tool settings is too close, so we will move it to -400. The sag tool works by sending a grid of probing rays towards the face of the object, so starting too close means the rays will start behind the object they are trying to measure.

Now look at the NSC Sag User Analysis. Click Settings. To estimate the X/Y Width, use the Active Cursor in the NSC 3D Layout plot as before. We can estimate that a square width of 500 mm should suffice for our probing region. Fill in all the values that we’ve determined for tilts and positions and make sure the box to Keep Object Tilts is checked. If you wish to save a .ZRD file for use by other analysis tools, click the ‘Keep ZRD File’ button and select a filename. The settings are shown below. To show the Advanced tab, click on the arrow in the bottom right corner.


Click OK and look at the analysis result to see a false color plot showing sag data.


Viewing Complex Objects

Consider a more complicated CAD part, such as this mechanical assembly:


We might want to look at a sag map using the NSC Sag tool, getting something like this:


Note that the object and the desired Sag graph of the object appear to be flipped. The Shaded Model shows the front side of the object, meaning that the Z axis points away from the viewer and in a right handed coordinate system, the positive X axis points to the left. The Sag tool simply presents X and Y values in a traditional manner, with positive X pointing to the right.

The CAD object here, LB_T67C_190608_GEOMETRY.STEP, has fifty-one faces, numbered 0 to 50 in the Coat/Scatter tab of the object properties. If we look at Face 11, for example, we will be looking at this portion:


To see the whole face, we need to combine all relevant faces. Open the file ‘basic sag image initial.zar’ to follow these steps. The initial sag will look like this:


The object property’s CAD tab has the means to combine faces into a single face. Here, the simplest way to do this is to go to the CAD tab of the object’s properties and click Select All:


Then click on Change To -> with the Face 0 as the option:


This will consolidate all faces into one, which can then be probed with the NSC Sag Tool.


The object sag should now look like this, also found in the file ‘basic sag image final.zar’:


NSC Sag Calculation with User Analysis Tool

The NSC Sag User Analysis is an older tool that performs a Sag analysis via the API, explicitly carrying out steps that are now done internally. For users who have work previously done with the User Analysis tool, the following is a description of the steps taken. This tool is still available as of Release 2023 R1.02.

  • A temporary copy of the system is created in memory
  • All objects except the selected object is set to ignore
  • The selected object’s material is removed to potentially account for the back face of the object
  • A single Source Ray is placed in the system
    • By default the source ray is placed at XYZ of (0, 0, -50) and pointing at LMN of (0, 0, 1), but these values can be changed in the advanced setting (bottom right of screen)
    • A rectangular array is then applied to the source that corresponds to the sampling and width
  • A ray trace is performed and the ZRD file is saved
  • X_HITFACE filter string is applied to the ray trace to only get the Z values for the desired face
  • An offset in Z is applied to the ZRD file to attempt to zero out the sag at the vertex
    • The Z offset is automatically calculated for Standard Lens, Biconic Zernike Surface, Even Asphere Lens, Odd Asphere Lens, and Toroidal Lens
    • The Z offset can be manually changed to account for any other type of surface

The result of the calculation is either a 1D (line)/2D (false color) graph or a text output, which can be selected in the Settings windows. The User Analysis can be used on simple non-sequential systems such as a converted Double Gauss, a Biconic Zernike Surface or a complex system with imported CAD parts.

The User Analysis tool can be found in the Programming tab under the User Analyses button, titled ‘NSC Sag’.




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



Article is closed for comments.