I cannot find in the doc what are the names of the parameters in the API to change the field density and wavelength, especialy in the MODIFYSETTINGS which does not mention this type of analysis
Maybe it is not implemented ?
Also, the analysis results do not exihbit any data:
As for the analysis results, these are also not exposed through data grids, but you can export them to a text file and read that file programmatically. This is the case for many analyses and again ZOSPy's source code may help you with figuring out how to do that.
As for the analysis results, these are also not exposed through data grids, but you can export them to a text file and read that file programmatically. This is the case for many analyses and again ZOSPy's source code may help you with figuring out how to do that.
thanks for you reply. For now I am getting familiar with the ZOSAPI, I’ll take a look at Zospy in the process.
I’m curious as how do you reverse-engineer the binary file ? Since it doesn’t seem to hold much logic or secret recipe, I’m wondering why CFG files are not just plain text files (json or yaml or like)
Kind of a bummer that not all analyses are available in the base API… having to workaround with writing and reading a text file feels ugly...
I’m curious as how do you reverse-engineer the binary file ? Since it doesn’t seem to hold much logic or secret recipe, I’m wondering why CFG files are not just plain text files (json or yaml or like)
The contents are basically just a binary array of numbers. The index and number of bytes for each setting you'll have to find out by trial and error, just change a byte and check what settings change in OpticStudio and how they change. I don't need to do this often (in the end, that's one of the reasons why I use ZOSPy) so the linked example in the ZOSPy code will give you more details than I can give off the top of my head right now.
Kind of a bummer that not all analyses are available in the base API… having to workaround with writing and reading a text file feels ugly...
I agree, but neither of the alternatives (waiting for Ansys to improve the ZOS-API support for analysis settings and results) are better than what we have now...
The index and number of bytes for each setting you'll have to find out by trial and error, just change a byte and check what settings change in OpticStudio and how they change.
If you just want to alter one specific setting this way, it might be quickest to save different configuration files that only differ in that one setting, and then compare the byte arrays. That should be slightly less cumbersome. However, if you already have all the settings files you need, you might as well load them using Settings.LoadFrom() rather than altering byte arrays.
If you have an implementation of this analysis, please also consider adding it to ZOSPy. This way others might also benefit from it!
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.