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?