Skip to main content

Hello fellow optics enthusiasts,

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

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)

Thanks a lot @chaasjes!

Yes, I’m using extension mode. I added TheApplication.ShowChangesInUI = False before the loop and set it back to True afte and now it’s much faster!

Really appreciate your help!

Sebastián


Reply