Hi everyone,
I’ve recently started using OpticStudio. Currently, I’m trying to incrementally change the clear semi-diameter of a surface within my system. I know this can easily be achieved with a FOR loop.
However, for each iteration, I hope to save the resulting wavefront map. Unfortunately, using GETTEXTFILE within a loop does not appear to work as intended, as the FOR loop seems to run as normal, but does not create the required files.
I’ve attached my code. If there’s any mistakes or changes that need to be made so that the solver iterates over the semi-diameter values and saves the wavefront map at each step, just let me know.
! Setting the desired format.
FORMAT 1 INT
FOR i, 0, 6, 1
! Reducing the clear semi-diameter by 5 lens units per iteration.
CLR_SEMI_DIAM = 52 - i*5
! Returning the new clear semi-diameter to the editor.
SOLVERETURN CLR_SEMI_DIAM
! Setting the output filename.
FLNM$ = "F:\LGS_104_Wavefront_Map_" + $STR(i) + ".txt"
! Writing the wavefront map for each iteration to a text file.
GETTEXTFILE FLNM$, Wfm
NEXT
Thanks in advance!
Ben