Navigation: Scripting Reference Manual > Functions & Subroutines > SetZernikeSurf

 

SetZernikeSurf

 

Contact Us: fredsupport@photonengr.com

 

Description

Sets the Zernike specific parameters for a Zernike surface.  Base surface, aspheric terms and coefficient interpretation flag values are set using their specific commands.

 

Syntax

SetZernikeSurf n, ent, semiApX, semiApY, coefs

 

Parameters

n As Long

Node number of the Zernike surface whose data is being modified.

 

ent As T_ENTITY

The new basic entity data for the new surface.

 

semiApX As Double

The new X aperture size for the surface.

 

semiApY As Double

The new Y aperture size for the surface.

 

coefs() As Double

Array of Zernike coefficients that define the Zernike surface.  The units of the values are designated by the state of the coefficient unit interpretation flag.

 

Remarks

The following script retrieves information from a Zernike surface, scales the coefficients by a wavelength factor and then sends the modified coefficients back to the Zernike surface.

 

Sub Main()

 

    Dim surf_node As Long

    surf_node = FindFullName( "Geometry.Elem.Z Surf" )

 

    ' retrieve zernike specific information

    Dim tEnt As T_ENTITY

    Dim semiX As Double, semiY As Double, coefs() As Double

    GetZernikeSurf( surf_node, tEnt, semiX, semiY, coefs() )

 

    ' loop over coefficients and modify

    Dim wl As Double

    wl = 0.5 'wavelength in microns

 

    Dim coef_count As Long, cur_coef As Long

    coef_count = GetZernikeSurfCoefCount( surf_node )

    If coef_count <> 0 Then

        Dim z_coefs() As Double

        ReDim z_coefs( coef_count-1 )

        For cur_coef = 0 To coef_count-1

 

            z_coefs( cur_coef ) = GetZernikeSurfIthCoef( surf_node, cur_coef )

            z_coefs( cur_coef ) = z_coefs( cur_coef )/(wl/1000)

 

        Next

    End If

 

    ' set the data back to the zernike surface

    SetZernikeSurf( surf_node, tEnt, semiX, semiY, z_coefs() )

 

End Sub

 

 

See Also

Zernike Surface Script Commands

T_ENTITY

 

 

 

 

 

Copyright © Photon Engineering, LLC