Navigation: Scripting Reference Manual > Functions & Subroutines > SourcePrimGetParmCount

 

SourcePrimGetParmCount

 

Contact Us: fredsupport@photonengr.com

 

Description

This function retrieves the number of parameters used a Source Primitive's definition.  The Point Source (incoherent) type Source Primitive, for example, has three parameters (indexed 0-2); total power, number of random ray directions, and the emission cone semi-angle.  If the queried node is not a Source Primitive, the function execution will halt with an error.

 

 

Syntax

nParm = SourcePrimGetParmCount( spNode )

 

 

Parameters

nParm (Long)

Returned total number of parameters in the Source Primitive.

 

spNode As Long

Node number of the Source Primitive being queried.

 

Example

The example below demonstrates how to determine if a node is a Source Primitive type, retrieve the number of parameters, and then iterate over all parameters and print the description string for the current parameter.

 

Sub Main

 

    'Source being queried

    Dim srcNode As Long

    srcNode = FindFullName( "Optical Sources.Point Source (incoherent)" )

 

    'Is this a source primitive?

    Dim spType As String

    spType = SourcePrimGetTypeSource(srcNode)

    If spType = "Unspecified" Then

        Print "Source is a Detailed Source type.  Stopping script."

        End

    End If

 

    'Retrieve number of parameters and print the parameter descriptions

    Print "Source Primitive type: " & spType

    Print "Parameter" & Chr(9) & "Desc."

    Dim curparm As Long

    For curparm = 0 To SourcePrimGetParmCount(srcNode)-1

        Print curparm;

        Print SourcePrimGetParmDescription(srcNode, curparm)

    Next

 

End Sub

 

 

See Also

Source Primitive Script Commands

AddSourcePrim

SourcePrimGetParmDescription

SourcePrimGetParmValue

SourcePrimSetParmValue

 

 

 

 

 

Copyright © Photon Engineering, LLC