A user asked why when using ZPL macro to save the Cross Section Row Coherent Irradiance data from Detector Viewer, the .txt file he got does not match the information displayed in the Text tab of the Detector Viewer. Instead of seeing a 2-column data of X position versus Irradiance, he kept seeing 3-column data displaying “Spatial Frequency, X and Y”
This is because in his code, the Configuration file is saved with the settings displayed in the Graph tab of the Detector Viewer, where the Cross Section Row is data value #4 in the “Show As:” dropdown list, (the index starts at 0). However, the GETTEXTFILE keyword is retrieving data from the Text tab of the Detector Viewer, where there isn’t a data value #4 in the “Show As:” dropdown list, so OpticStudio simply saves the data from the last available data value #3 which is the “Geometric MTF”.
In order to save the data for the Cross Section Row irradiance, you need to use MODIFYSETTINGS keyword to set this “Show As:” data value to data value #1 which then points to “Show As: Cross Section Row” in the Text tab of the Detector Viewer. A code snippet is shown below for your reference.
For i,1,3,1
z = 0.01*(i-2)
SETNSCPOSITION 1, 5, 3, z
Update ALL
a= NSDD(1,0,0,0)
NSTR 1,2,0,0,0,0,0
OPENANALYSISWINDOW DVR,
LOCKWINDOW i+2
path1$ = 'C:\Users\hui.chen\Documents\Support related\Customer Files temp\'
config$ = path1$ + 'TestGetTextFile.CFG'
MODIFYSETTINGS config$, DVW_SHOW, 1
MODIFYSETTINGS config$, DVW_DATA, 1
FORMAT 1 INT
z$ = $str(i)
path2$ = 'C:\Users\hui.chen\Documents\Zemax\'
filename$ = path2$ + 'CrossSection' + z$ + '.txt'
GETTEXTFILE filename$, DVR
MODIFYSETTINGS config$, DVW_SHOW, 4
MODIFYSETTINGS config$, DVW_DATA, 1
Next