Navigation: Scripting Reference Manual > Functions & Subroutines > SourcePrimSetWavelSingle

 

SourcePrimSetWavelSingle

 

Contact Us: fredsupport@photonengr.com

 

Description

This subroutine sets the wavelength value for a Source Primitive node using the Single wavelength generation option.  If the source node being modified is not using the Single wavelength specification option, the subroutine will halt with an error.

 

 

Syntax

SourcePrimSetWavelSingle( spNode, wavel )

 

 

Parameters

spNode As Long

Node number of the Source Primitive being modified.

 

wavel As Double

Wavelength value (in microns) being applied to the source.

 

Example

The example below demonstrates how to create a new Point Source (incoherent) type Source Primitive with a total power of 2.0 Watts and emitting 10,000 rays into a cone with a semi-angle of 10 Degrees.  A single wavelength value of 0.5 microns is assigned and the draw color is set to red.

 

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 (incoherent)"

 

    '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

    SourcePrimSetParmValue( spNode, 0, 2.0   ) 'power in watts

    SourcePrimSetParmValue( spNode, 1, 10000 ) 'total number of random ray directions

    SourcePrimSetParmValue( spNode, 2, 10.0  ) 'emission cone semi-angle (degrees)

 

    'Configure wavelength settings

    'Use single wavelength

    SourcePrimSetWavelSpectValue( spNode, "Single" )

    SourcePrimSetWavelSingle( spNode, 0.5 )

 

    '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

SourcePrimGetWavelSingle

SourcePrimGetWavelSpectValue

SourcePrimSetWavelSpectValue

 

 

 

 

 

Copyright © Photon Engineering, LLC