This article explains how to measure and display the sag of an object in Non-Sequential Mode using the NSC Sag User Analysis feature. Learn about the basics of this capability, including how to setup a file with a complex CAD part to get the sag values for a specific face.
Authored By Michael Humphreys
Downloads
Introduction
Sequential Mode of OptocStudio 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. Non-Sequential Mode does not have a built-in analysis which provides the same functionality, but the software does have a robust application programming interface (API) which allows users to write their own custom analysis features. This article will show how to use an API built user analysis which calculates the surface sag for non-sequential objects. It will also discuss the internal calculations and some techniques for creating a custom user analysis.
NSC Sag calculation
The NSC Sag User Analysis performs several steps to calculate the sag value of a given Object Face in Non-Sequential Mode:
- 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 settng (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:
Running NSC Sag
The NSC Sag is a User Analysis. For convenience, it has been added to the Interface and can be found under Analyze...NSC Sag.
But more generally, user analysis executables are located in {Zemax}\ZOS-API\User Analysis folder. Once the executable is copied in that correct folder, OpticStudio needs to be restarted.
To launch the User Analysis, click on Programming...User Analysis...NSC Sag:
The first time the analysis is launched, click on Settings:
The Settings window has the following sections (all length values are in lens units):
- Object – only valid objects (non-source and non-detector) are listed
- Face – once a valid object is selected, only the actual object’s faces are listed
- Sample Size – number of data points (32, 64, 128, 256, 512, or 1024)
- Z Offset – constant value added/subtracted from all Z values during calculation
- Rotation – Z-axis rotation of object (values should be between 0° and 360°)
- X/Y Width – with of array of rays
- X/Y Decenter – center of array of rays
- Show As – data type to display (False Color, Text, or Cross Section)
- Auto Offset – automatically “guesses” the correct values for Z Offset & X/Y Width for common objects & faces
- Advanced – exposes advanced settings:
- Z starting position of array of rays
- Preserves original XY tilt of object
- Saves intermediate ZMX and ZRD files
- Buttons – OK runs the analysis and Cancel closes settings without performing calculations
Measuring a CAD File
The NSC Sag User Analysis 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 on the user’s behave. 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 surface can be clicked. The surface will turn orange. The highlighted face number will appear in the viewer’s tab:
Next, to determine the proper tilts and decenters, insert a new a object below the CAD part and change the object to Source Ray; set the Z Position to -50mm (the default value for the NSC Sag analysis) and the # Layout Rays to 1. Now open NSC 3D Layout and see how the ray interacts with the CAD part.
If the ray is currently centered on the CAD part, no modification is required. However, if the part is rotated with respect to the ray or the ray is not at the center of the part, then change the Tilt About X/Y of the CAD Part or 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/Y/Z as a variable 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 attached sample file, the Tilt About X of the RandomCurve.STEP should be -79.2 and the (X, Y, Z) positions should be (260, 500, -400):
Now, open up the NSC Sag User Analysis. Click Settings. To estimate the X/Y Width, use the Active Cursor in the NSC 3D Layout plot. The settings are shown below. To show the Advanced tab, click on the arrow in the bottom right corner; make sure to uncheck Remove XY Tilt and check Keep Saved Files:
Click OK and look at the actual analysis result. Although the Sample Size was set very low, a false color plot, which shows some sag data, is produced:
There will be a new file in the current folder called nsc_sag_map.zmx. Open this file and look at the NSC 3D Layout. A single Source Ray is repeated on a (N+1)x(N+1) grid with a spacing that correlates to the X/Y Width from the Settings form.
Now that the data is verified in the plot and the saved file is fully covered with rays, the sampling can be increased as well as the widths & decenters to get the best image.
The following Settings will produce the final image:
KA-01652
Comments
Article is closed for comments.