Navigation: Scripting Reference Manual > Functions & Subroutines > GetZernikeSurfIthAsphTermText

 

GetZernikeSurfIthAsphTermText

 

Contact Us: fredsupport@photonengr.com

 

Description

This function returns the string representation for the form of the I'th aspheric term.

 

Syntax

text = GetZernikeSurfIthAsphTermText ( indx )

 

Parameters

text (String)

String describing the aspheric term at the specified index (base 1).

 

indx As Long

Index of the aspheric term whose string representation is being retrieved.  Terms are defined base 1 and range from 1 to 8.

 

Example

The following script retrieves all information from a Zernike surface and prints a formatted summary of that information to the output window.

 

Sub Main()

 

    ' node of the zernike surface

    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() )

 

    ' retrieve base surface information

    Dim b_curv As Double, b_con As Double

    GetZernikeSurfBaseConic surf_node, b_curv, b_con    

    Dim OffAxisAngle As Double, Xoffset As Double, Yoffset As Double

    OffAxisAngle = GetZernikeSurfOffaxisAngle(surf_node)

    Xoffset = GetZernikeSurfXoffset(surf_node)

    Yoffset = GetZernikeSurfYoffset(surf_node)

 

    ' retrieve aspheric term information

    Dim asph_count As Long, cur_asph As Long

    asph_count = GetZernikeSurfAsphCoefCount( surf_node )

    If asph_count <> 0 Then

        Dim asph() As Double, s_asph() As String

        ReDim asph( asph_count-1 ) : ReDim s_asph( asph_count-1 )

        For cur_asph = 1 To asph_count

 

            asph( cur_asph-1 ) = GetZernikeSurfIthAsphCoef( surf_node, cur_asph )

            s_asph( cur_asph-1 ) = GetZernikeSurfIthAsphTermText( cur_asph )

 

        Next

    End If

 

    ' retrieve zernike term information

    Dim wvl_flag As Boolean

    Dim wl As Double

    GetZernikeSurfCoefInterpretation( surf_node, wvl_flag, wl )

    Dim coef_count As Long, cur_coef As Long

    coef_count = GetZernikeSurfCoefCount( surf_node )

    If coef_count <> 0 Then

        Dim z_coefs() As Double, s_coefs() As String

        ReDim z_coefs( coef_count-1 ) : ReDim s_coefs( coef_count-1 )

        For cur_coef = 0 To coef_count-1

 

            z_coefs( cur_coef ) = GetZernikeSurfIthCoef( surf_node, cur_coef )

            s_coefs( cur_coef ) = GetZernikeSurfIthTermText( cur_coef )

 

        Next

    End If

 

    ' finally...print everything to the output window

    Print "Name: " & GetName( surf_node )

    Print "Base Curvature: " & b_curv

    Print "Base Conic: " & b_con    

    Print "Off Axis Angle: " & OffAxisAngle

    Print "X Offset: " & Xoffset

    Print "Y Offset: " & Yoffset

    If asph_count > 0 Then

        Print "Aspheric Terms: "

        Print Chr(9) & "Term" & Chr(9) & "Value" & Chr(9) & "Form"

        For cur_asph = 1 To asph_count

            Print Chr(9) & cur_asph & Chr(9) & asph( cur_asph-1 ) & Chr(9) & s_asph( cur_asph-1 )

        Next

    Else

        Print "Aspheric Terms: None"

    End If

    If wvl_flag Then

        Print "Zernike in waves: " & wvl_flag & " (" & wl & ")"

    Else

        Print "Zernike in waves: " & wvl_flag

    End If

    If coef_count > 0 Then

        Print "Zernike Terms: "

        Print Chr(9) & "Term" & Chr(9) & "Value" & Chr(9) & "Form"

        For cur_coef = 0 To coef_count-1

            Print Chr(9) & cur_coef & Chr(9) & z_coefs( cur_coef ) & Chr(9) & s_coefs( cur_coef )

        Next

    Else

        Print "Zernike Terms: None"

    End If

 

End Sub

 

 

See Also

Zernike Surface Script Commands

 

 

 

 

 

 

 

Copyright © Photon Engineering, LLC