How to read absorption data from material via ZOS-API
I just want to read all data from the material behind a surface in a given lens system which I need to construct the wavelength dependent complex refractive index for that material. I already managed to read the real valued refrative index (dispersion) via ZOSAPI.Tools.IMaterialsCatalog.
But I cannot find a way to read the wavelength dependent absorption data from the same material.
Does anybody have an advice or hint for me?
Looking forward to your answers. Thank you.
Page 1 / 1
Hi Rene,
Unfortunately, the only “button” hooked up from the bottom section of the Materials Catalog is the Save Catalog As. No other buttons including the transmission section is hooked up.
Luckily, the AGF file is a text-based file so you can write a simple parser to open the AGF file, loop through until you find the NM line which matches your desired glass, then continue to read lines until you get to the IT line; once you get to the next NM line, you have finished parsing all the data for the desired glass.
Below is C# pseudo code from a similar task I had to accomplish:
Admittedly, I am already aware of the possibility of parsing the AGF file. The background of my question is the possibility that the text-based material data will be replaced by binaries eventually (just like the ZMX format is being replaced by the ZOS format).
I just want to be prepared for the case that reading the text-based files isn’t possible anymore. And since reading the dispersion data can be done via ZOSAPI.Tools.IMaterialsCatalog, I was hoping for a similar possibility for the absorption data…
Cheers, René
Hi Rene,
Your concern about text-based Zemax files being replaced by binary versions may be mitigated somewhat by this change at Zemax as recently posted by Alissa (see:Save .ZMX files by default ):