Navigation: Scripting Reference Manual > Functions & Subroutines > SourcePrimSetParmValue

 

SourcePrimSetParmValue

 

Contact Us: fredsupport@photonengr.com

 

Description

This subroutine sets the value of a specific Source Primitive construction parameter.  Each parameter is accessed using a 0-based index value (as seen in the GUI dialog for a Source Primitive).  Note that not all Source Primitive types are eligible to use this command and the function will halt with an error if an invalid Source Primitive type is queried.  Refer to the Source Primitive Parameters Help topic for more information on parameter indexing, retrieval and modification.

 

 

Syntax

SourcePrimSetParmValue( spNode, parmIndex, parmValue )

 

 

Parameters

spNode As Long

Node number of the Source Primitive being modified.

 

parmIndex As Long

Parameter index whose parameter value is being set.

 

parmValue As Variant

Value being specified for the parameter at index parmIndex.  The type of value supplied depends on the specific parameter being accessed.  Refer to the Source Primitive Parameters Help topic for more information on parameter indexing, retrieval and modification.

 

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 Parameters Listing

Source Primitive Script Commands

SourcePrimGetParmValue

SourcePrimSetParmLaser

SourcePrimSetParmLEDff

SourcePrimSetParmPtSrcCoh

SourcePrimSetParmRayFan

 

 

 

 

 

Copyright © Photon Engineering, LLC