Navigation: Scripting Reference Manual > Functions & Subroutines > SetZernikeSurfOffsets

 

SetZernikeSurfOffsets

 

Contact Us: fredsupport@photonengr.com

 

Description

Sets the X and Y offsets of a Zernike surface.

 

Syntax

SetZernikeSurfOffsets n, dXoffset, dYoffset

 

Parameters

n As Long

Node number of the Zernike surface.

 

dXoffset As Double

The X offset of the surface.

 

dYoffset As Double

The Y offset of the surface.

 

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