What is the structure of a command in the ZOS-API? How do I read the ZOS-API help documentation?
ZOS-API syntax help?
Best answer by Allie
There are two primary resources for API help: firstly, there are several various articles available on the Knowledgebase which provide examples and tutorials. Secondly, there’s a help document dedicated only to API syntax, which is accessible through The Help Tab…ZOS-API Syntax Help or in your OpticStudio install folder. That document provides the properties, methods, and inheritances of each object type, as well as around two dozen example scripts which demonstrate general functionality in the 4 programming languages we primarily support (MATLAB, Python, C#, and C++).
When reading the ZOS-API Syntax document, the important thing to remember is that methods return objects which are members of the displayed interface (or type). Similarly, the type of a property is also given to the left of the property name. For example (in pseudo-code), using the method GetSurfaceAt() the user might make the assignment:
Surface1 = TheApplication.PrimarySystem.LDE.GetSurfaceAt(1)
Here, the newly assigned item named “Surface1” is a member of the interface ILDERow. We know that because in the ZOS-API Syntax Help document, the method GetSurfaceAt() is shown to return an object of type ILDERow:
In the API Syntax Help, we can now click on the above-highlighted “ILDERow” (the interface to which the Surface1 object belongs) to see all of the properties, methods, etc. available to the Surface1 object. For example, in the ILDERow interface, we can see there’s a property “Thickness”, which is a [get/set] property. The type is double, which we know because the API Syntax Help says “double” next to the property name. So, we can then change the thickness of surface 1 with:
Surface1.Thickness = 50
Or, we could have done this with a single assignment, using:
TheApplication.PrimarySystem.LDE.GetSurfaceAt(1).Thickness = 50
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.