Solved

using OPEV operand to calculate DSLP

  • 8 November 2021
  • 6 replies
  • 202 views

Badge

Hi

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? :-)

Thank you

icon

Best answer by Chris Normanshire 9 November 2021, 12:31

View original

6 replies

Userlevel 7
Badge +2

Hi Renaud,

 

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.

Take care,

 

David

Badge

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.

Thanks again.

Renaud

 

Userlevel 3
Badge +2

Hi Renaud,

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.

print OPEW(OCOD("DSLP"),1,0,1,2,0,0,0,1)

Thanks,

Chris

Badge

Great! Thank you Chris. 

I should have read that better :slight_smile:

 

Userlevel 3
Badge +2

Happy to help. That’s what we have a community for :slight_smile:

Userlevel 7
Badge +2

Thanks Chris! I also didn’t read this :(

Reply