Skip to main content
Solved

Enter Zernike Fringe Phase Surface from Python API

  • September 14, 2022
  • 1 reply
  • 269 views

Niko.Romer

I am trying to take a known set of Fringe Zernike Coefficients, and insert them into a zemax optical system model as a Zernike Fringe Phase surface. I’ve gotten as far as being able to insert the surface and set it as a Zernike Fringe Phase type, but I haven’t had any success with entering coefficient values into the LDE. 

I’ve tried 

LDE.GetSurfaceAt(28).GetCellAt(14).DoubleValue = value

where value is a float, but it throws an exception saying that a Double was expected and it got a string. I’ve also tried to just return a value that I’ve typed in manually, but had no success that way either. Can anyone point me in the right direction here? It seems like it should be simple with entering numbers into the LDE, but nothing has seemed to work so far. 

 

Thanks

Best answer by MichaelH

Hey Niko,

Without actually creating a test script, the GetCellAt() method is for all editors, not just the LDE, and starts at the left most column.  I’m thinking that with GetCellAt(14), you’re trying to change Par14, but you’re really trying to change one of the unused columns for the Zernike Fringe Phase (around Par3).  To have a more 1:1 comparison with column headers in the LDE, I would suggest using the ILDERow method of GetSurfaceCell(SurfaceColumn.Par14).  This way, you know you’re always looking at Par14 rather than a random column. 

You can also determine the offset (fixed number of columns to the left of Par0) and use this like GetCellAt(14 + offset)...the problem is I always forget what the offset is for each type of editor.

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

1 reply

MichaelH
Ansys Staff
Forum|alt.badge.img+2
  • Ansys Staff
  • 355 replies
  • Answer
  • September 15, 2022

Hey Niko,

Without actually creating a test script, the GetCellAt() method is for all editors, not just the LDE, and starts at the left most column.  I’m thinking that with GetCellAt(14), you’re trying to change Par14, but you’re really trying to change one of the unused columns for the Zernike Fringe Phase (around Par3).  To have a more 1:1 comparison with column headers in the LDE, I would suggest using the ILDERow method of GetSurfaceCell(SurfaceColumn.Par14).  This way, you know you’re always looking at Par14 rather than a random column. 

You can also determine the offset (fixed number of columns to the left of Par0) and use this like GetCellAt(14 + offset)...the problem is I always forget what the offset is for each type of editor.


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