Description Adds a Zernike polynomial surface to the associated FRED document. The ordering of the individual polynomial terms is not standardized. FRED uses a common, but not universal, ordering as listed in the help topic Zernike Surface. The base conic, aspheric terms and coefficient interpretation flag are specified after the surface has been created using their specific commands.
Syntax n = AddZernikeSurf ( entity, semiApeX, semiApeY, coeffs() )
Parameters n (Long) Node number of the newly added surface.
entity As T_ENTITY Holds the basic entity data for the new surface.
semiApeX As Double Holds the X aperture size for the surface.
semiApeY As Double Holds the Y aperture size for the surface.
coeffs() As Double Array of Zernike coefficients in system units.
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 b_curv = 0.02 b_con = -1 SetZernikeSurfBaseConic( surf_node, b_curv, b_con )
' 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
|