Hi,
Having started with the default python Interactive Extension template generated by OpticStudio, I added the following code:
# Insert Code Here
huygens_psf = TheSystem.Analyses.New_HuygensPsf()
huygens_psf.ApplyAndWaitForCompletion()
success = huygens_psf.GetResults().GetTextFile("textdump.txt")
print(success)
When running this as an interactive extension, the following gets printed to my terminal emulator:
Found OpticStudio at: %sc:\program files\zemax opticstudio Connected to OpticStudio Serial #: L118546 True
That last “True” implies that the GetTextFile() supposedly was successful in writing the PSF data as a text file. But, looking at the directory from which I was running the python file and in which it was located, I can’t see the textdump.txt
which should have been generated. I repeated the same thing with the more explicit complete path (C:/…
etc, which is a reflection of my personal system) but again to no avail. This is the smallest reproducible example of this problem, but I initially saw it in the context of a larger program which could successfully load the PSF and read the values by huygens_psf.GetResults().GetDataGrid().Values
, for example. This leads me to believe that the PSF analysis is done correctly and successfully, and that the correct thing is returned by GetResults(). Has this kind of problem been seen before? Could it be some sort of internal OpticStudio settings or operating system security settings? Where could I start to look for the cause of this behavior?
My python version is 3.8.13, my pythonnet version is 2.5.2, and my OpticStudio version is 22.2.1.
Thanks for your help,
Daniel