Navigation: Scripting Reference Manual > Functions & Subroutines > DeleteSourceDirIthMultiPos

 

DeleteSourceDirIthMultiPos

 

Contact Us: fredsupport@photonengr.com

 

Description

For a source node with a ray direction type, "Multiple source positions", this subroutine deletes the position 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-position entries.  If a source node has no multi-position specification entries, no rays will be created by the source.  The position specifications set the directions that the rays will propagate from (i.e. if the Z value of a multi-position specification is positive, the rays will propagate in the -Z direction.  Multi-position specifications are provided in the coordinate system of the source node.

 

Syntax

DeleteSourceDirIthMultiPos( 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 multi-position specifications in a source node with a rectilinear grid of new positions.

 

Sub Main

 

    'Source node being modified

    Dim src As Long

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

 

    'Grid of positions 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 = -4 : xMax = 4

    yMin = -4 : yMax = 4

    nX   = 3

    nY   = 3

 

    'Derive position steps

    Dim xStep As Double, yStep As Double

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

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

 

    'Delete existing positions

    Dim curPos As Long, nPos As Long

    nPos = GetSourceDirMultiPosCount( src )

    For curPos = nPos-1 To 0 Step -1

        DeleteSourceDirIthMultiPos( src, curPos )

    Next

 

    'Print Header row

    Print ""

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

 

    'Add new position(s)

    'Ray directions are set as though they are coming FROM the points added below

    Dim curX As Long, curY As Long, ithPos As Long

    Dim xPos As Double, yPos As Double

    For curX = 0 To nX-1

        For curY = 0 To nY-1

            xPos   = xMin + xStep*curX

            yPos   = yMin + yStep*curY

            ithPos = AddSourceDirIthMultiPos( src, xPos, yPos, -10.0, True )

            Print ithPos;

            Print xPos;

            Print yPos

        Next

    Next

 

    Update

 

End Sub

 

See Also

Source Script Commands

AddSourceDirIthMultiPos

InsertSourceDirIthMultiPos

IsSourceDirMultiPos

SetSourceDirMultiPos

SetSourceDirIthMultiPos

SetSourceDirIthMultiPosActive

GetSourceDirMultiPosCount

GetSourceDirIthMultiPos

GetSourceDirIthMultiPosActive

 

 

 

 

 

 

Copyright © Photon Engineering, LLC