# Display pupils on a layout plot

You can easily show the Entrance and Exit Pupils in both the Lens Data Editor (LDE) and Layout Plots by using dummy surfaces and pickups to show the location of the pupils without affecting the other surfaces in your sequential system. This article walks through how to use ZPL Macro and Chief Ray Height thickness solves in the LDE as well as hiding dummy surfaces in a layout plot.

Authored By Michael Humphreys

Article Attachments

## Introduction

It is often useful to be able to visualize the location of the Entrance and Exit Pupil in order to properly calibrate your optical design. This can be easily done in OpticStudio.

In this article, we walk through setting up dummy surfaces that are representative of the Entrance and Exit Pupils for easy visualization of the full system.

## Pupil information

In order to show the Entrance Pupil (EP) and Exit Pupil (XP) in the Lens Date Editor and as surfaces in a layout plot, we will insert dummy surfaces in the Lens Data Editor to simulate the pupil locations. Attached to this article is the result of this work-through. If you would like to follow along, please note that this article will be referencing the Double Gauss 28 degree field lens located in the {Zemax}\Samples\Sequential\Objectives folder.

For sequential systems, you can find the location of the pupils in the Analyze...Reports...Prescription Data report.

For this system, the pupils are as follows:

• Entrance Pupil Diameter:   33.33 mm
• Entrance Pupil Position:     58.93976 mm
• Exit Pupil Diameter:           36.25844 mm
• Exit Pupil Position:            -108.0596 mm

In OpticStudio, the EP location is always referenced to Surface 1 and the XP location is always referenced to the Image Surface. In order to reduce the modifications to your LDE order, it is a good idea to place the dummy surfaces immediately before the first lens and before the image surface.

By definition, a pupil is where the chief ray crosses the optical axis or where the chief ray has 0 height. OpticStudio conveniently has a built-in thickness solve that will automatically determine where the paraxial chief ray height is 0 for a given surface: Chief Ray Height. The only caveat is that this ray based solve, along with any other ray based solve, has to come after the Stop surface. Therefore, we can only use the Chief Ray Height solve for the XP location. For the EP location, we can use a ZPL Macro solve. Note that OpticStudio has a Pupil Position built-in solve that uses real, differential rays rather than paraxial rays for the XP which might be useful for non-axial systems or systems where the pupil cannot accurately be determined with paraxial rays, but we will use the Chief Ray Height method in this article since the difference between the paraxial (fewer computational cycles) and real (more computationally intensive) is out to the 6th decimal place.

## Insert dummy surfaces

To get started, we will need to insert four dummy surfaces - two before Surface 1 for the EP and two before the Image Surface for XP. The article will refer to these dummy surfaces as D1-D4.

Before performing the actual calculations, we will set up the pair of surfaces. Set a Pickup solve on the thickness of D2 & D4 to be a scale factor of -1 from D1 & D3 respectively.  A”P” will appear next to the surface with a Thickness Pickup solve.

Then, we need to set the Surface Properties of these 4 surfaces, along with the surface immediately following D2 (labeled D2+1 in the table below), so OpticStudio does not actually draw rays to them. These can be found in the Draw Tab of the Surface Properties.

You need to set the following check boxes for each of the surfaces:

 D1 D2 D2 + 1 D3 D4 Hide Rays To This Surface X X Skip Rays To This Surface X X X Do Not Draw This Surface X

## Exit Pupil

Now, let’s do the easier XP location first. Simply click on the Thickness Solve for D3, select Chief Ray Height and keep the Height equal to 0.  A “C” will be placed in the solve box to the right of the value. All wavefront calculations are performed in the XP with respect to a reference sphere. The chief ray reference sphere curvature is just the thickness to the XP itself, so you can also set a pickup on the Radius of D4 and reference D3 Thickness with a -1 factor.

## Entrance Pupil

For the EP location, we will need to use a ZPL Solve. Create a new ZPL Macro by navigating to the Programming tab:

Save the new macro as LDE_EP.ZPL. Copy and paste the following code into the macro:

SOLVEBEFORESTOP SOLVERETURN OPEV(OCOD("ENPP"),0,0,0,0,0,0)

The SOLVEBEFORESTOP keyword is required as the first line in a ZPL Macro solve that uses ray trace data. It specifies that the solve will be placed before the Stop. Certain calculations are not valid when tracing rays are required and the Help System outlines when you can and cannot use the SOLVEBEFORESTOP. The OPEV(OCOD()) combination is a useful way of getting the same value that you would from a given Merit Function Operand without having to insert that operand into the Merit Function Editor.

Then click on the solve box for D1, select ZPL Macro and type in "LDE_EP" without the quotes (note that the name is not case sensitive).

Your layout will now have 2 new dummy surfaces at the pupils.

There are systems, such as an object space telecentric lens, where this technique might not be useful since the EP would be located at negative infinity.

KA-01619