! zoomedge.zpl
! Written by Kenneth E. Moore 8/92
!
! This macro computes the maximum aperture for each surface
! required to pass all rays in all zoom positions
! without vignetting. The non-zoomed semi-diameters
! will be reset to the maximum required aperture.
!
! The macro cannot alter, and will ignore, apertures
! which are already user-defined.
!
! After the semi-diameters are reset, the edge thickness for
! each surface in each zoom position is computed and displayed.
!
format .0
numconfig = ncon()
print "There are ",numconfig," zoom positions defined."
! start at first surface
sur = 0
label 1
        sur = sur + 1
        max = 0
        config = 0
        label 2
                config = config+1
                setconfig config
                tem = sdia(sur)
                if (max < tem) then max = tem
                if ( config < numconfig ) then goto 2
        format 3.0
        print "The max semi-diameter of surface ", sur,
        format 8.4        
        print " is ", max, 
        format 3.0
        print " in configuration ", config
        sdia sur = max
!        
! Now compute the edge thickness at each zoom position
!
        config = 0
        label 3
                config = config+1
                setconfig config
                tem = edge(sur)
                format 3.0
                print "  Zoom ",config,": ",
                format 8.4
                print "Edge thickness: ",tem
                if ( config < numconfig ) then goto 3
        if (sur < (nsur()-1) ) then goto 1
print
print "All Done!"


