I am trying to calculate the RMS slope of a surface with the DSLP operand in a macro.
The surface is Zernike Standard Sag (generated from tolerance analysis) and the rms slope of this surface computed in the MF editor is like below
I wrote the following to calculate the same value in a macro:
> print OPEV(OCOD("DSLP"),1,1,2,0,0,1)
but this is obviously not correct as the output is 3.4456 (I was excpecting 4.913e-5).
I can’t find the error, can you? :-)
Best answer by Chris NormanshireView original
I tried it on my end and also get the same behaviour. I suspect it relates to the columns used by DSLP. If you look in your screenshot there are two empty columns between Sruf and Data, as well as between Remove and Orientation. If you put the OPEV parameters by the columns they correspond to, it behaves a little bit better for me. Meaning, in your case, you could use:
OPEV(OCOD(“DSLP”), 1, 0, 1, 2, 0, 0)
However, one cannot access the Orientation column. I suspect this is a bug.
Thank you David.
Indeed, it works with your example but, as you said, we cannot access the last data of the operand, which makes it a bit useless to me…
Probably a bug indeed. I will contact Zemax support to report it.
The OPEV function can only access upto 4 arguments for a merit function operand. For an operand like DSLP you’ll need to use the OPEW function instead. The following should work for you.
Great! Thank you Chris.
I should have read that better
Happy to help. That’s what we have a community for
Thanks Chris! I also didn’t read this :(