Description This function adds a new Source Primitive node of a requested type to the document and returns the node number of the new object.
Syntax spNode = AddSourcePrim( spType, tEnt )
Parameters spNode (Long) Returned node number of the newly added Source Primitive.
spType As String Argument specifying the type of Source Primitive to be added. Options are: Plane Wave (coherent) Plane Wave (incoherent) Point Source (coherent) Point Source (incoherent) Laser Beam (00 mode) Astigmatic Gaussian Beam Laser Diode Beam (coherent) M-Squared Laser Beam Lambertian Plane Lambertian Surface Rayfile Source Random Volume into a sphere Ray Fan Solar Source (simple) Laser Diode (incoherent) LED (far-field) Bitmap
tEnt As T_ENTITY Data structure defining the generic entity information (name, description, etc.).
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
|