The ZOS-API is an extension programming which allows external applications to connect to OpticStudio by means of a .NET interface. This article provides an example of the standalone method, in which the external application is Mathematica.
Authored By Erin Elliott & David Keith
Two types of connections are supported in the ZOS-API: 'standalone", in which the external application starts its own copy of OpticStudio with which to interact; and 'interactive', in which OpticStudio is already running and will call the external application.
This article provides an example of the standalone method, with Mathematica as the external application. A Mathematica notebook is used as a user interface and scripting language. It will start an OpticStudio session, load an existing sequential lens file, manipulate that lens file to alter the lens design, perform an analysis, and obtain and process the results to provide information not directly available through OpticStudio.
Information on using .NET/Link, which is the Mathematica .NET interface, can be found at http://reference.wolfram.com/language/NETLink/tutorial/Overview.html, or through the help system of a running Mathematica notebook.
This example was developed using OpticStudio 15 and Mathematica 10.1 running on Windows 7, 64-bit. It has also been tested with OpticStudio 18 and Mathematica 11.2 on Windows 10. It was developed by closely following the examples in the first release of the document "ZOS-API Documentation.pdf."
The information is best viewed as the Mathematica notebook itself, which is attached to this article. (Mathematica_to_ZOS.nb) For those with Mathematica, this notebook can be loaded, executed, and used as a starting point for a new notebook. Following an introduction into the syntax of the program, the notebook provides the basic code to open an existing file, obtain system values, and run an FFT MFT analysis.
For those without Mathematica, a PDF of the notebook is also attached. This has been done because the presentation of the notebook would be difficult to replicate in the usual Knowledgebase format. Viewing the PDF is the best way to read the notebook without Mathematica.