Skip to main content
Solved

ZOS-API Interactive Mode: CalculateMeritFunction() Does not update the Merit Value nor the Merit Operands

  • August 28, 2025
  • 1 reply
  • 106 views

Forum|alt.badge.img
  • Fully Spectral
  • 52 replies

In interactive mode - I would like to update the merit value and the operand values after every perturbation I do on a surface variable (e.g.; Decenter-X). 

For some reason - executing this code line does not seem to update the IDE at all.

# Before perturbation: apply a value to a surface cell
TheSystem.MFE.CalculateMeritFunction()
# After perturbation: Step to read updated Merit Values and Merit Operand Values - No Change!

Any ideas?

Best answer by Asuku

Not sure why it wouldn’t update but using the following line of code right after solved the issue.

# update all windows in Zemax
ZOSAPI.LensUpdateMode.AllWindows

Marking the question as solved.

Thanks - Asuku

1 reply

Forum|alt.badge.img
  • Author
  • Fully Spectral
  • 52 replies
  • Answer
  • August 29, 2025

Not sure why it wouldn’t update but using the following line of code right after solved the issue.

# update all windows in Zemax
ZOSAPI.LensUpdateMode.AllWindows

Marking the question as solved.

Thanks - Asuku