Navigation: Scripting Reference Manual > Functions & Subroutines > SourcePrimSetParmPtSrcCohList

 

SourcePrimSetParmPtSrcCohList

 

Contact Us: fredsupport@photonengr.com

 

Description

This function sets the configuration parameters for a Point Source (coherent) type Source Primitive using the List wavelength option.  For a Point Source (coherent) type that uses the Single wavelength option, the SourcePrimSetParmPtSrcCohSingle function should be used.

 

 

Syntax

success = SourcePrimSetParmPtSrcCohSingle( spNode, tPtSrc, tWls() )

 

 

Parameters

success (Boolean)

Returned boolean indicating whether the parameters were successfully applied to the source node.

 

spNode As Long

Node number of the Point Source (coherent) type Source Primitive being modified.

 

tPtSrc as T_SOURCEPRIMPTSRCCOH

Data structure containing the configuration parameters of the Point Source.

 

tWls() As T_WAVELENGTHSPEC

Array of T_WAVELENGTHSPEC data structures that contains the wavelength data.  The array is zero-indexed, with tWls(0) containing the T_WAVELENGTHSPEC data for the first wavelength and tWls(n-1) containing the T_WAVELENGTHSPEC data for the n'th wavelength.  Refer to the example below to see how the array can be dimensioned and populated with data.

 

 

Example

The example below demonstrates how to add a Point Source (coherent) type Source Primitive using the List wavelength option.

 

Sub Main

 

     Dim spNode As Long

    Dim spType As String

    Dim tEnt As T_ENTITY

 

    'String specifying the type of SP being created

    spType = "Point Source (coherent)"

 

    'Generic entity information

    InitEntity( tEnt )

    tEnt.name        = spType

    tEnt.Description = "Added via scripting"

 

    'Add the node

    spNode = AddSourcePrim( spType, tEnt )

    Print "Source primitive added at node number " & spNode

 

    'Configure parameter settings

    Dim success As Boolean

    Dim tPtSrc As T_SOURCEPRIMPTSRCCOH

    tPtSrc.num        = 15 'Number of angular samples

    tPtSrc.phi        = 30 'Semi-angle of emission

    tPtSrc.PowerWatts = 1.0 'Power emitted in units of Watts

 

    'Construct wavelength list data

    Dim tWls(5) As T_WAVELENGTHSPEC

    tWls(0).wavelen = 0.4  : tWls(0).weight = 0.02

    tWls(1).wavelen = 0.45 : tWls(1).weight = 0.57

    tWls(2).wavelen = 0.5  : tWls(2).weight = 0.27

    tWls(3).wavelen = 0.6  : tWls(3).weight = 0.44

    tWls(4).wavelen = 0.65 : tWls(4).weight = 0.08

    tWls(5).wavelen = 0.7  : tWls(5).weight = 0.003

 

    'Update the source parameters

    success = SourcePrimSetParmPtSrcCohList( spNode, tPtSrc, tWls() )

 

    'Source draw color R=255, G=0, B=0

    SourcePrimSetDrawColor( spNode, 255, 0, 0 )

 

    'Update the document

    Update

 

End Sub

 

 

See Also

Source Primitive Script Commands

Point Source (coherent)

SourcePrimGetParmPtSrcCohList

SourcePrimGetParmPtSrcCohSingle

SourcePrimSetParmPtSrcCohSingle

T_SOURCEPRIMPTSRCCOH

 

 

 

 

 

Copyright © Photon Engineering, LLC