Zemax Manual

Zemax Manual.pdf - Free ebook download as PDF File (.pdf), Text File (.txt) or read book online for free. Scribd is the world's largest social reading and publishing site. Open navigation menu. ZEMAX ® Optical Design Program User's Manual July 8, 2011 Radiant ZEMAX LLC support@zemax.com www.zemax.com.

As mentioned in last section, although Zemax is already very powerful in optical design, there are times the designer needs to further extend its functions to fit some special design needs. Therefore, Zemax provided a tool called Zemax Programming Language (ZPL) to allow users to write their own procedures. ZPL is a macro language specifically designed for use with Zemax. It’s similar to the BASIC programming language, except not all BASIC constructs and keywords are supported, and capabilities and functions unique to ray tracing have been added.

ZPL macros can be created and edited with any text editor (such as Notepad editor in Windows). The file may have any name but must end in the .ZPL extension. File name may include letter (upper case and lower case letters are treated as the same) and numbers, but may not include some special characters such as ~ ( ) = + – * / ! > < ^ & | #. The file must be placed in the ZPL Folder, which by default is “Macros”. The default folder can be changed through Zemax main menu: File –>Preferences –> Directories, as shown in figure 1.2-1:

Fig. 1.2-1 ZPL Path setting

Each time after modifying the path, the macro list should be refreshed through Zemax main menu: Macros –> Refresh Macro List, so the ZPL files in the updated folder can be seen properly.

Subfolders under the updated path can also be added, and ZPL files can be put into the subfolders without modifying the path settings. This is convenient and can help managing files. For example, under the path “D:My Macros” shown in figure 2-1, two subfolders Project 1 and Project 2 can be created, and different ZPL files can be put in each of the subfolders, and shown in figure 1.2-2:

Fig. 1.2-2 Managing ZPL files through subfolders

Rememeber to refresh the macro list underthe main menu each time after creating new subfolders and writing new ZPL programs.

ZPL programs can be run from the main menu, select Macros –> Edit/ Run ZPL Macros. When doing so, ZPL control dialog box will pop up in the main window, as shown in figure 1.2-3:

Fig. 1.2-3 ZPL control dialog box

Zemax Manual

The following options are in the ZPL control dialog box:

  • Active File: A drop-down list of macros available. The target macro can be chosen here.
  • Close After Execution: If checked, the ZPL control dialog box will automatically close after the macro execution.
  • Quiet Mode: If checked, the default output text window will not be shown. This is useful for graphics macros that do not generate useful text.
  • Check Obsolete Syntax: If checked, Zemax will test the macro for use of obsolete syntax.
  • Status: During execution of the macro, Zemax will use this area to print a status message stating the line
  • number of the macro being executed. The status message is updated every quarter second.
  • Terminate: The terminate button will stop execution of the macro currently running.
  • Cancel: The cancel button terminates the current macro if one is running. If no macro is running, cancel closes the ZPL control dialog box.
  • Edit: The edit button invokes the Windows NOTEPAD editor. The editor can be used to modify or rename the macro.
  • View: The view button will display the contents of the macro file in a text window which can be scrolled or printed. No editing is allowed in the view window.

To run a macro, simply select the macro from the “Active File” list, and then click on Execute

Besides using ZPL control dialog box to run ZPL programs, one can also directly click the macro name in the “Macros” menu under the main menu to run it, as shown in figure 1.2-4:

Fig. 1.2-4 Run ZPL program directly

Zemax also provides some shortcut buttons to allow convenient access to frequently used macros. By assigning macros to some buttons, one can directly run the macro by simply pressing the shortcut button. Macros can be assigned from the main menu, select File –> Preferences, and in the Preferences dialog, a macro can be connected to a button, as shown in figure 1.2-5:

Zemax Macro Manual

Fig. 1.2-5 Shortcut button setting

(… to be continued)

Zemax User Manual

Thanks for reading. Open Source Photonics Blogs are supported by 612 Photonics LLC.

Zemax Manual

A pdf version of the contents of this series of blog plus some more real application examples, as well as all the .zpl files used in the blogs, are now available for purchase from our sponsor’s website

Opticstudio

The price is US$19.99

Zemax

You can directly send your payment along with your email address to their PayPal account

Zemax manual pdf

612photonics@gmail.com

Please kindly support our work, so we can continue to provide more valuable contents.

Non-Sequential Ray Tracing, optics, Ray Tracing, Sequential Ray Tracing, Zemax, ZPL