I'm using the Interactive Extension to add several lenses to my sequential system. To make the program run faster, I want to turn off OpticStudio's auto-update feature while the lenses are added and edited, then I want to turn it back on once that is done. How can I do this?
To change the update mode of OpticStudio, we can use the UpdateMode property (found under the ZOSAPI.IOpticalSystem Interface Reference):
We see in the above image the UpdateMode is a part of the LensUpdateMode interface. If we click that in the help documentation, we are brought to a list of valid enumerators for this interface:
So, to be able to change the update mode, we have to call it from our system and set it equal to one of the enumerations available in the LensUpdateMode interface.
The MATLAB syntax to turn auto-updating off would then look like the following:
TheSystem.UpdateMode = ZOSAPI.LensUpdateMode.None;
To change it back, we could replace "None" with "EditorsOnly" or "AllWindows".
For more information on ZOS-API syntax, check out the Knowledgebase article "Understand the basics of ZOS-API structure".
In python, the None enumerator gives error, while the other two work correctly. It seems an overlap with the None python value. Here is the error:
>>> ZOSAPI.LensUpdateMode.None
^
SyntaxError: invalid syntax
If I change the first letter’s case I correctly obtain the following error:
>>> ZOSAPI.LensUpdateMode.none
Traceback (most recent call last):
AttributeError: type object 'LensUpdateMode' has no attribute 'none'
Any idea?
Thank you
Hi
With that in mind, try this:
TheSystem.UpdateMode = 0
TheSystem.Save()
print(TheSystem.UpdateMode)
As far as I’m aware, all of the enumerators in the API index at 0. So you can pull up their listing in the Syntax Guide and identify which enumeration you want by number for any one, if you want.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.