Solved

Can we use ZPLM to read analysis window data and optimize

  • 9 June 2022
  • 1 reply
  • 138 views

Userlevel 5
Badge +3

For example, I want to use the ZPLM distortion data generated by the analysis window (just for example, we can use distortion related operands DIMX.DISG,DIST with OPER). 

icon

Best answer by yuan.chen 9 June 2022, 04:43

View original

1 reply

Userlevel 5
Badge +3

No and Yes.

Why No:

The data we get from the user interface is always the data of the primary system(where we start)

It’s mentioned here:

The Optimize Tab (sequential ui mode) > Optimization Overview > User Defined Operands (optimization overview) > Changes Made to the Lens from within the ZPLM Marcro 

The merit function is always evaluated using a temporary copy of the lens. After evaluation of the merit function, the copy of the lens, and any changes made to the lens, are discarded. For this reason, no changes should be made to the lens data from within the macro called by the ZPLM operand. These changes are not retained and may interfere with the computation of operands following the ZPLM operand in the same merit function evaluation. OpticStudio does not restore the lens being evaluated to the state it was in prior to the evaluation of the ZPLM specified macro. If however the macro is intentionally used to alter the lens data prior to evaluation of subsequent operands, two macros should be executed. The first should modify the data as required, and the second should restore the data to the original condition. Both macros can be listed in the merit function editor, with the intervening operands executing on the altered lens data.

Macro commands that manipulate the user interface, such as CLOSEWINDOW, WINL(), and GETT() are not effective. The reason for this restriction is that these commands pull information from the single system copy reflected in the user interface. Thus, even though the ZPLM macro updates the system copies, the primary system copy that the user interface displays will not be updated.

How Yes:

We could not manipulate the user interface, but we can use GETTEXTFILE to generate the correct data of the temporary copy. 

You can find the example macro ZPL08 to optimize the distortion.

 

Reply