Display Pupils on a Layout Plot

You can easily show the Entrance and Exit Pupils in both the 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 Lens Data Editor (LDE) as well as hiding dummy surfaces in a layout plot.
Michael Humphreys
11/13/2016
Sequential

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.  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
Entrance Pupil Position :          58.93976
Exit Pupil Diameter     :          36.25844
Exit Pupil Position     :         -108.0596


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.  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. 

To get started, 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 the Thickness Pickup on 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        

 
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.

For the EP location, we will need to use a ZPL Solve.  Create a new ZPL Macro, found in the Programming Tab, and save it 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 and the solve will be placed before the Stop.  Certain calculations are not valid when tracing rays are required and the Help Manual 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 with 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 will be located at negative infinity.