Skip to main content
Solved

using OPEV operand to calculate DSLP

  • November 8, 2021
  • 6 replies
  • 241 views

Forum|alt.badge.img

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

Best answer by Chris Normanshire

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

View original
Did this topic help you find an answer to your question?

6 replies

David.Nguyen
Luminary
Forum|alt.badge.img+2
  • Luminary
  • 1085 replies
  • November 9, 2021

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


Forum|alt.badge.img
  • Author
  • Infrared
  • 12 replies
  • November 9, 2021

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

 


Chris Normanshire
Zemax Staff
Forum|alt.badge.img+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


Forum|alt.badge.img
  • Author
  • Infrared
  • 12 replies
  • November 9, 2021

Great! Thank you Chris. 

I should have read that better :slight_smile:

 


Chris Normanshire
Zemax Staff
Forum|alt.badge.img+2

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


David.Nguyen
Luminary
Forum|alt.badge.img+2
  • Luminary
  • 1085 replies
  • November 9, 2021

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings