Question

Are blackbox files incompatible with the API?

  • 12 November 2023
  • 1 reply
  • 32 views

Badge

I am using a standalone Matlab API in sequential mode to load a .zmx file and do various analysis with data handed back to Matlab.  This works perfectly except when I include a blackbox element.  The .zmx file loads and I can modify and query it in standard ways.  When I execute any analysis (e.g. a PSF calculation), the structures returned are empty.   I don’t get an error message, just empty results.  If I replace the blackbox lens with a stock element, everything works again.  I can execute the analysis in OpticStudio by loading the .zmx file (with the blackbox) and selecting the analysis from the menu.  

Are blackboxes incompatible with the API or is there something special you need to do, maybe telling the blackbox file to load after the .zmx file is loaded?

Thanks in advance for any pointers!


1 reply

Userlevel 1

Hi Robert,

i use zos-api from python connecting as_extension. 

  1. i create new surface  LDE.InsertNewSurfaceAt(xx)
  2. set surface type to constants.Editors.LDE.SurfaceType.BlackBoxLens

  3. set surface comment to the filename of the BB file  .Comment=”xx.BB”

  4. ensure the xx.BB file is copied to Zemax\BlackBoxesdirectory

and it seems to work well for basic simple ray tracing.

I am newbie and unfortunately limited to python syntax, but may be the 4th point could help fix the strange behaviour you describe.

Reply