ZPLM macro- GETT() is not effective to extract values, is there a workaround?

  • 16 March 2020
  • 3 replies
  • 141 views

Userlevel 4
Badge +2
I'm using numeric function GETT() to extract values from an opened window, but it is said from helpfile that 

Macro commands that manipulate the user interface, such as CLOSEWINDOW, WINL(), and GETT() are not effective. 

Is there a workaround to extract values from analysis window? For example, I was going to extract values from 19th row of an opened Geometric Image Analysis cross section window.  


 

3 replies

Userlevel 4
Badge +2

When using ZPLM to create a user defined operand, the merit function is always evaluated using a temporary copy of the lens.

GETT() extracts a numerical value from any opened text window.This is reflected in the user interface.

However, any updates taken effect on the copy of the current system will not have effect on the currently opened analysis window. That's why GETT() is not effective for ZPLM macros. In the situation, the keyword GETTEXTFILE can still be used to extract values. 

For example, save setting for Geometric image analysis first(or use keyword MODIFYSETTINGS) and then try with the following code:


A$ = $TEMPFILENAME()
GETTEXTFILE A$, Ima
OPEN A$
line_num=1
LABEL 1
READSTRING B$
IF (line_num>=30) THEN GOTO 2
# PRINT B$
line_num=line_num+1
GOTO 1
LABEL 2
READ X1,Y1
READ X2,Y2
READ X3,Y3
DELETEFILE A$
CLOSE
#PRINT X1," ",Y1
#PRINT X2," ",Y2
#PRINT X3," ",Y3
OPTRETURN 1, Y1
OPTRETURN 2, Y2
OPTRETURN 3, Y3

Is the same think possible for 'Spt'?


I would like to extract the RMS spot radii as numeric value (not strings), see below:


 


A$ = $TEMPFILENAME()

GETTEXTFILE A$, 'Spt'   # alternative to GETT

OPEN A$


READSTRING B$


For i,1,18,1

       READ

NEXT

READSKIP 23

READSTRING spotx$

READSTRING spoty$

READSTRING spotmax$


PRINT spoty$


DELETEFILE A$

CLOSE


 

Userlevel 3
Badge +2

Hi Jonas,


Yes, you can also use GETTEXTFILE to extract data from the Spot Diagram using Spt as type (you need to remove the apostrophe in the second line of your macro). To convert String to numbers you may use SVAL(A$).


Something like this will report the RMS Spot Radius, RMS X Size, RMS Y Size and the Max Spot Radius from the Spot Diagram:


A$ = $TEMPFILENAME()

GETTEXTFILE A$, Spt   

OPEN A$



For i,1,17,1

READSTRING B$

       

NEXT



READSTRING spotr$

val$ = $RIGHTSTRING(spotr$, 20)

Sr = SVAL(val$)

print 'RMS Spot Radius :', Sr



READSTRING spotx$

val$ = $RIGHTSTRING(spotx$, 20)

Sx = SVAL(val$)

print 'RMS Spot X Size :', Sx



READSTRING spoty$

val$ = $RIGHTSTRING(spoty$, 20)

Sy = SVAL(val$)

print 'RMS Spot Y Size :', Sy



READSTRING spotmax$

val$ = $RIGHTSTRING(spotmax$, 20)

Sm = SVAL(val$)

print 'Max Spot Radius :', Sm



DELETEFILE A$

CLOSE

Reply