I’m currently working on a task where I need to ignore multiple surfaces in a Zemax optical system using the ZOS-API. At the moment, I’m using the following loop:
for i in range(150, 160): surface = TheSystem.LDE.GetSurfaceAt(i) surface.TypeData.IgnoreSurface = True
However, this approach seems to be quite slow. Has anyone found a more efficient way to ignore multiple surfaces at once?
Any insights or suggestions would be greatly appreciated!
Thanks in advance, Sebastián
Best answer by chaasjes
I am afraid there are no alternatives to doing this in a loop.
However, do you run this in extension mode? Updating a boolean property doesn't take much time, but in extension mode, it takes some time to update the UI. If you are using the ZOS-API in extension mode, you'll see a significant speed-up if you take one of these measures:
Connect to OpticStudio in standalone mode;
Turn UI updates off before expensive operations and on again afterwards. You can do this with TheApplication.ShowChangesInUI = False # (or True).
I am afraid there are no alternatives to doing this in a loop.
However, do you run this in extension mode? Updating a boolean property doesn't take much time, but in extension mode, it takes some time to update the UI. If you are using the ZOS-API in extension mode, you'll see a significant speed-up if you take one of these measures:
Connect to OpticStudio in standalone mode;
Turn UI updates off before expensive operations and on again afterwards. You can do this with TheApplication.ShowChangesInUI = False # (or True).