Description This function initiates the recording of a "Two source user-recorded holographic optical element" type grating specification, with options for recording each of the two sources independently.
Syntax nRays = DiffractHOEExRecord( grat, record1, record2 )
Parameters nRays (Long) Returned number of total rays used in the recording process. If both sources are requested to be recorded, nRays is the sum total of the rays used for recording both sources.
record1 As Boolean If True, source 1 of the grating specification will be recorded.
record2 As Boolean If True, source 2 of the grating specification will be recorded.
Example The example below demonstrates how to retrieve and report the current configuration for a grating of the type, "Two source user-recorded holographic optical element", modify the grating configuration, and re-record the hologram.
Sub Main
'User-recorded grating surface Dim grat As Long grat = FindFullName( "Geometry.HoeX Grating.HoeX Grating.HoeX Surf" )
'Retrieve current grating specification Dim src1 As Long, src2 As Long Dim is1real As Boolean, is2real As Boolean Dim ncoefs1 As Long, ncoefs2 As Long GetDiffractHOEEx( grat, src1, src2, is1real, is2real, ncoefs1, ncoefs2 )
'Print summary of grating specification Print "" Print "Grating surface: " & GetFullName( grat ) Print Chr(9) & "Source 1" & Chr(9) & "Source 2" Print "Node:" & Chr(9) & GetName(src1) & Chr(9) & GetName(src2) Print "Real:" & Chr(9) & is1real & Chr(9) & is2real Print "Terms:" & Chr(9) & ncoefs1 & Chr(9) & ncoefs2
'Modify the grating specification by doubling coefficients and re-record both sources Dim nRays As Long SetDiffractHOEEx( grat, -1, src2, is1real, is2real, 2*ncoefs1, 2*ncoefs2 ) nRays = DiffractHOEExRecord( grat, True, True )
'Report recording If nRays = 0 Then Print "Recording failed." Else Print "Rays used in hologram recording: " & nRays End If
End Sub
See Also Diffraction Grating Script Commands
|