Navigation: Scripting Reference Manual > Functions & Subroutines > SetZernikeSurfCoefInterpretation

 

SetZernikeSurfCoefInterpretation

 

Contact Us: fredsupport@photonengr.com

 

Description

Sets the Zernike surface coefficient interpretation flag that indicates whether the coefficient values are interpreted in waves or system units.

 

Syntax

SetZernikeSurfCoefInterpretation n, InWavelengths, wavelength

 

Parameters

n As Long

Node number of the Zernike surface.

 

InWavelengths As Boolean

Indicates whether coefficient is in waves or not. If True, the coefficients are in waves. If False, coefficients are in system units.

 

wavelength As Double

Wavelength for which coefficient is expressed if InWavelengths is True.

 

Example

The following example creates a Zernike surface as the child of an existing custom element.  Once the surface has been created, the base surface parameters, interpretation flag and aspheric coefficients are specified.

 

Sub Main( )

 

    ' parent entity for the surface

    Dim parent_node As Long

    parent_node = FindFullName( "Geometry.Elem" )

 

    ' initialize and create surface

    Dim tEnt As T_ENTITY

    InitEntity( tEnt )

    tEnt.parent = parent_node

 

    Dim semiX As Double, semiY As Double

    semiX = 2

    semiY = 2

 

    Dim surf_node As Long

    Dim coefs(5) As Double

    coefs(0) = 0.001

    coefs(1) = 0.002

    coefs(3) = 0.003

    coefs(4) = 0.004

    coefs(5) = 0.005

    surf_node = AddZernikeSurf( tEnt, semiX, semiY, coefs() )

 

    ' set base surface parameters

    Dim b_curv As Double, b_con As Double, dAng As Double, dXoffset As Double, dYoffset As Double

    b_curv = 0.02 : b_con = -1

    dAng = 5 : dXoffset = 1 : dYoffset = 2

    SetZernikeSurfBaseConic( surf_node, b_curv, b_con )

    SetZernikeSurfOffaxisAngle(surf_node, dAng)

    SetZernikeSurfOffsets(surf_node, dXoffset, dYoffset)

 

    ' set zernike coefficient interpretation

    SetZernikeSurfCoefInterpretation( surf_node, True, 0.5 )

 

    ' set aspheric coefficients

    Dim num_coefs As Long

    num_coefs = 4

    Dim cur_coef As Long

    Dim sf As Double

    sf = 1e-5

    For cur_coef = 1 To num_coefs

        SetZernikeSurfIthAsphCoef( surf_node, cur_coef, (2*Rnd()-1)*sf )

    Next cur_coef

 

    Update

 

End Sub

 

 

See Also

Zernike Surface Script Commands 

 

 

 

 

 

Copyright © Photon Engineering, LLC