Navigation: Scripting Reference Manual > Functions & Subroutines > DeleteSourceDirIthMultiAngle

 

DeleteSourceDirIthMultiAngle

 

Contact Us: fredsupport@photonengr.com

 

Description

For a source node with a ray direction type, "Multiple source angles (plane waves)", this subroutine deletes the angle specification at a given index from the ray direction list.  The index value is 0-based.  Note that it is possible to delete all of a source's multi-angle entries.  If a source node has no multi-angle specification entries, no rays will be created by the source.

 

Syntax

DeleteSourceDirIthMultiAngle( src, idx )

 

Parameters

src As Long

Node number of the source being modified.

 

idx As Long

Index into the ray direction list of the specification that will be deleted.  The index value is 0-based.

 

Example

The example below shows how to replace the existing list of angles in a source node with a rectilinear grid of directions in angle space.

 

Sub Main

 

    'Source node being modified

    Dim src As Long

    src = FindFullName( "Optical Sources.Multi Angle Source" )

 

    'Grid of angles we want to create

    Dim xMin As Double, xMax As Double

    Dim yMin As Double, yMax As Double

    Dim nX As Long, nY As Long

    xMin = -10 : xMax = 10

    yMin = -20 : yMax = 20

    nX   = 3

    nY   = 3

 

    'Derive angle step

    Dim xStep As Double, yStep As Double

    xStep = (xMax - xMin)/(nX-1)

    yStep = (yMax - yMin)/(nY-1)

 

    'Delete existing angles

    Dim curAng As Long, nAng As Long

    nAng = GetSourceDirMultiAngleCount( src )

    For curAng = nAng-1 To 0 Step -1

        DeleteSourceDirIthMultiAngle( src, curAng )

    Next

 

    'Print Header row

    Print ""

    Print "Entry" & Chr(9) & "X (deg)" & Chr(9) & "Y (deg)"

 

    'Add new angle(s)

    Dim curX As Long, curY As Long, ithAng As Long

    Dim xAng As Double, yAng As Double

    For curX = 0 To nX-1

        For curY = 0 To nY-1

            xAng   = xMin + xStep*curX

            yAng   = yMin + yStep*curY

            ithAng = AddSourceDirIthMultiAngle( src, xAng, yAng, True )

            Print ithAng;

            Print xAng;

            Print yAng

        Next

    Next

 

    Update

 

End Sub

 

See Also

Source Script Commands

InsertSourceDirIthMultiAngle

AddSourceDirIthMultiAngle

IsSourceDirMultiAngle

SetSourceDirMultiAngle

SetSourceDirIthMultiAngle

SetSourceDirIthMultiAngleActive

GetSourceDirMultiAngleCount

GetSourceDirIthMultiAngle

GetSourceDirIthMultiAngleActive

 

 

 

 

 

Copyright © Photon Engineering, LLC