Navigation: Scripting Reference Manual > Functions & Subroutines > GetDiffractHOEEx

 

GetDiffractHOEEx

 

Contact Us: fredsupport@photonengr.com

 

Description

This subroutine retrieves the configuration parameters from a grating of the type "Two source user-recorded holographic optical element".

 

 

Syntax

GetDiffractHOEEx( grat, src1, src2, is1real, is2real, ncoefs1, ncoefs2 )

 

 

Parameters

grat As Long

Node number of the grating surface whose "Two source user-recorded holographic optical element" specification is being retrieved.

 

src1 As Long

Node number of the source being used as recording source 1 in the grating specification.  The return value will be -1 for the "None" option if it is being used.

 

src2 As Long

Node number of the source being used as recording source 2 in the grating specification.  The return value will be -1 for the "None" option if it is being used.

 

is1real As Boolean

True if the source 1 OPL is "real" and False if the source is "virtual".

 

is2real As Boolean

True if the source 2 OPL is "real" and False if the source is "virtual".

 

ncoefs1 As Long

Indicates the number of polynomial coefficients being used for OPL fitting during the recording of grating source 1.

 

ncoefs2 As Long

Indicates the number of polynomial coefficients being used for OPL fitting during the recording of grating source 2.

 

 

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

Diffraction Gratings

 

 

 

 

 

Copyright © Photon Engineering, LLC