Description This function sets the type of wavelength generation method being used by a Source Primitive. The wavelength options supported for each Source Primitive type are given in their respective Help topics (Source Primitives). Additional wavelength information may need to be supplied to the source node after the wavelength generation method is specified (ex. designate a spectrum, or single wavelength value).
If the Source Primitive node being modified does not support the specified wavelength mode, the function will halt with error: "Command error, parameter name doesn't match the Source Primitive type."
This command is not applicable to the Point Source (coherent), Astigmatic Gaussian Beam, Laser Diode Beam or M-Squared Laser Beam type Source Primitives. Please refer to the following script commands when operating on these source types: SourcePrimSetParmPtSrcCohSingle
Syntax SourcePrimSetWavelSpectValue( spNode, wlType )
Parameters spNode As Long Node number of the Source Primitive being modified.
wlType As String Type string specifying the wavelength generation option to be used by the Source Primitive node. Not all wavelength types are supported by every Source Primitive, so refer to each Source Primitive's respective Help topic (Source Primitives). Options are:
Examples The following script examples demonstrate how to set wavelength specifications of various types for Source Primitives.
The example below demonstrates how to create a Source Primitive and assign the Single wavelength specification. 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
The example below demonstrates how to create a new Source Primitive and assign it a custom list of wavelengths and weights.
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 List of wavelengths SourcePrimSetWavelSpectValue( spNode, "List" )
'Define the wavelength list Dim tWl As T_WAVELENGTHSPEC 'Edit 0'th wavelength tWl.wavelen = 0.486 : tWl.weight = 0.5 SetSourceIthWavelengthSpec( spNode, 0, tWl ) 'Add additional wavelengths tWl.wavelen = 0.587 : tWl.weight = 1.0 AddSourceWavelengthSpec( spNode, tWl ) tWl.wavelen = 0.656 : tWl.weight = 0.5 AddSourceWavelengthSpec( spNode, tWl )
'Source draw color R=255, G=0, B=0 SourcePrimSetDrawColor( spNode, 255, 0, 0 )
'Update the document Update
End Sub
The following example demonstrates how to create a Source Primitive and configure it to generate wavelengths randomly according to a spectrum. A spectrum node must be available for use by the Source Primitive.
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
'Spectrum and wavelength range Dim spectNode As Long, wlMin As Double, wlMax As Double spectNode = SpectrumFindName( "Gaussian" ) wlMin = 0.5 : wlMax = 0.55
'Configure Source Primitive wavelength settings SourcePrimSetWavelSpectValue( spNode, "Random According To Spectrum" ) SetSourceSpectrum( spNode, spectNode ) SetSourceRayWavelengthRange( spNode, wlMin, wlMax )
'Source draw color R=255, G=0, B=0 SourcePrimSetDrawColor( spNode, 255, 0, 0 )
'Update the document Update
End Sub
The example below demonstrates how to specify that a Rayfile type Source Primitive use wavelength data from the supplied rayfile (Note: a Rayfile type source primitive can optionally also use the Random according to spectrum 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 = "Rayfile Source"
'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, 2, "C:\temp\fred\support\rayfileWithWavelengths.fcr" ) 'Rayfile to be used
'Configure Source Primitive wavelength settings SourcePrimSetWavelSpectValue( spNode, "Rayfile" )
'Source draw color R=255, G=0, B=0 SourcePrimSetDrawColor( spNode, 255, 0, 0 )
'Update the document Update
End Sub
The example below demonstrates how to add a Bitmap type Source Primitive and then configure it to use the Bitmap wavelengths 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 = "Bitmap"
'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, 100 ) 'Power SourcePrimSetParmValue( spNode, 1, "C:\temp\fred\support\photonlogo.jpg" ) 'Bitmap file location SourcePrimSetParmValue( spNode, 2, 5 ) 'Random rays per pixel per wavelength SourcePrimSetParmValue( spNode, 3, 100 ) 'Random ray directions per ray position SourcePrimSetParmValue( spNode, 4, 4 ) 'X semi-width of the bitmap source in document units SourcePrimSetParmValue( spNode, 5, 2 ) 'Y semi-width of the bitmap source in document units SourcePrimSetParmValue( spNode, 6, 15 )'Semi-angle of emission along the x-axis SourcePrimSetParmValue( spNode, 7, 15 )'Semi-angle of emission along the y-axis SourcePrimSetParmValue( spNode, 8, "Ellipse/Circle" )'Shape of the angular emission cone
'Configure wavelength settings SourcePrimSetWavelSpectValue( spNode, "Bitmap" )
'Update the document Update
End Sub
See Also Source Primitive Script Commands
|