Hi!
I am facing a similar issue when trying to perform a MC defining as the tolerancing criterion a user script. If I define the CPAR in the script referring to a coordinate break and specifying tiltX or tiltY as the compensator, everything works fine without errors. However, if I set the CPAR in the script to refer to a “Zernike standard sag” surface and assign parameter numbers 16 or 17 (to set as a compensators Z2 and Z3) then I get the same error, i.e. “nominal criterion cannot be computed”.
I also tested a similar approach, but instead of usin the script, I directly set the merit function as the criterion and defined the compensators in the tolerance data editor as CPAR Surf# Param16 and Param17. In that case, the error does not appear and I can get the results without any problem.
Did you figure out how to solve this? Or does anyone know how to handle this issue specifically through a user script?
Thank you very much!!
I also found no issue when I defined the compensators in the tolerance data editor. I also found that Zernike terms are also not correctly perturbed when using the “PERTURB” command in a tolerance script (no error is thrown for this, but after generating MC files you will find that the specified terms will still have a 0 value). So the issue seems to be related to Zernike terms specifically.
I went as far as to open a ticket with Zemax on this issue and it’s still unresolved. Customer support was able to replicate but no luck with a solution, even temporary. For my case I think I wound up using a combination of workarounds: I used Irregular surface type instead for perturbing irregularity, and to use a Zernike surface as a compensator I first generate MCs without the compensator defined, then used a ZPL macro to reopen the MCs, set desired parameters to variable, then reoptimized and saved. It was considerably more time consuming and still didn’t quite replicate the routine I was hoping for, but it got me through.
In your case, the Irregular surface type may work, it has Tilt X and Tilt Y parameters.
I also tried something similar to what you mentioned, but using the ZOS API. I run the MC simulations correcting the tilt with a coordinate break, save the MC files, reopen them, and then optimize with the Z2 and Z3 terms of the Zernike Standard Sag as variables, saving the files again.
Since the CB approach followed by reoptimization works well for me, I think I’ll stick with that solution. However, it’s good to know that no issues come up with the irregular surface.
Thank you for your answer! Let’s hope the support team can figure out how to solve the issue.