Solved

Reading surface comments in OpticStudio 23.1

  • 14 March 2023
  • 1 reply
  • 79 views

Badge

I am trying to update and use a set of Python scripts. The code used to retrieve surface comments from the Zemax model no longer seems to work in OpticStudio 23.1. This code was all written several years ago, so uses the older win32com library rather than the newer preferred .NET approach, but it does still work on another computer running OpticStudio 22.1, so has something changed in the API definitions over the past year?

surface_name = system.LDE.GetSurfaceAt(k).Comment

doesn’t return a string, but <COMObject Comment>, and I can’t work out how to actually get the string out of this.

The script works if I replace this line with 

surface_name = str(system.LDE.GetSurfaceAt(k).GetSurfaceCell(1))

While this fixes the problem, it’s obviously less readable, and I’m not sure why this change is needed. Any suggestions on why the original code isn’t working any more?

 

icon

Best answer by Sahil 28 March 2023, 19:27

View original

1 reply

Userlevel 4
Badge +1

Hello Stephen,

Thanks for your question.

Their is a bug for OpticStuidio 23.1. I have reported the bug to our product team.

Actually in LDE,I have explained below accessing the first column from API  resulting next column as shown below.

 

 

Thanks

Sahil

Reply