I was helping a colleague with ZPL the other day. He wanted to know how to set a field as a variable and then constrain it. Additionally, he wanted to do this through a ZPL.
The first part is easy enough. My approach was to expose the field as a variable through the multi-configuration editor using “YFIE”, declaring the solve as “Variable” and then constraining it in the merit function editor with “MCOL”, “MCOG”, or “MCOV”.
For the ZPL portion, I wrote a small script for him demonstrating how to assign a variable in the MCE with ZPL.
CLOSEWINDOW
! INSERTMCO, 1 # insert a row into the mce.
SETMCOPERAND 1, 0, "YFIE", 0 # changes the operand to "YFIE"
SETMCOPERAND 1, 0, 1, 1 # assigns YFIE to field no. 1
SETMCOPERAND 1, 1, 15, 0 # changes the value of row 1 config 1 to 15
SETMCOPERAND 1, 1, 1, 3 # changes the solve type to "V"
BEEP
This made me think that it would be useful if there were a way to record GUI interactions as lines in a ZPL. For example, I could turn on the proposed feature and a text window would open in the background. When I click on row 1 of the multi-configuration editor and press “insert” a line would appear in the text editor “INSERTMCO, 1”. Once I have completed my task, I would turn off the feature, review the text file and could use it as reference for writing my own ZPL.
I realize that this is easy to conceptualize but perhaps difficult to implement. I didn’t see anything in the help file that resembled this idea. It there a way to do this with Zemax currently? If not, it would be useful as a feature request.