Question

Issues with ZOS-API

  • 15 March 2023
  • 0 replies
  • 61 views

I’m using a grin 5 surface using a material from an edited SGRIN.dat file and getting errors upon loading it in a Python standalone.

If I open the file in a regular OpticStudio window, there is no error message and it works perfectly. However, if I try to load it in Python, the grin 5 surface is causing some issues. In Python, I will get the status "Can't find glass *CAF2* in catalog!" (CAF2 is the first glass after the GRIN 5 surface). If I save the file in Python and open it in OpticStudio, then it will throw the error “Can’t find GRIN 5 glass *customglassname* in SGRIN.DAT!”. This can be resolved if I change the GRIN 5 material to air, which then triggers a glass not found error for every glass in the rest of the system. This is because in the material catalogues, all of the catalogues I had been using have somehow been removed from “Catalogues to use”. After fixing that up, if I change the GRIN 5 material back to what it was originally, there is no error and it works as it did before.

From there I can save the file and reopen it with no issues in an OpticStudio window, but will always have the issue if opened and saved in Python.

I tried saving CFG files in OpticStudio and loading them in Python using TheConnection.PreferencesFile = ‘path/to/cfg’, but it does not seem to work. I tried changing the glass catalogue folder to another that has the edited SGRIN.dat

 

Any help on this would be very much appreciated, as this functionality is critical to our projects.


0 replies

Be the first to reply!

Reply