Hello everyone out there,
I use a python script and successfully execute some commands:
open a zmx file in the back ground, add/change operands in the merit function, (local) optimization and finally i save the zmx file. When I manually open that file after the python script was run, I can see that everything was executed as intened.
But I fail to use a python script to: load a merit function that simply runs a zplm to export jpg, the exported file are 0 kB “empty”.
Here is the corresponding python script:
TheMFE = TheSystem.MFE
TheSystem = zosapi.TheSystem
## not shown here, but working perfectly fine:
# open zmx file, adding/changing operands in merit function,
# changign values in the lensdata editor, [...]
# running optimization and saving file
# Now I just want to save the focal shift window and spot diagram to jpg
FocalShift = TheSystem.Analyses.New_FocalShiftDiagram()
FocalShift.ApplyAndWaitForCompletion()
Spot = TheSystem.Analyses.New_StandardSpot()
Spot.ApplyAndWaitForCompletion()
mf=r'C:/Test/ExportImage.MF'
TheMFE.LoadMeritFunction(mf)
TheMFE.CalculateMeritFunction()
ExportImage.MF is:
VERS 210726
ZPLM 55 0 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00
and ZPL55.zpl is:
GETSYSTEMDATA 1
EXPORTJPG 1, "C:\Test\Shift"
EXPORTBMP 2, "C:\Test\Spot"
OPTRETURN 0
Now, the funny thing is: when I manually open the zmx file, manually open the ExportImage.MF, it instantly works as expected: the Shift.jpg and Spot.jpg appear (about 44kB) and are the exact pictures I want.
However, when I load ExportImage.MF via python, the jpgs appear also instantly but are empty.
What am I missing? Has anyone of you encountered that problem as well?
I already tried different winnums, different names, different position in the code. But I have no clue, because the macro workds when I manually load it.
Thanks a lot in advance and best regards
Sarah