Navigation: Scripting Reference Manual > Functions & Subroutines > ElemAddScatter

 

ElemAddScatter

 

Contact Us: fredsupport@photonengr.com

 

Description

Adds a scatter model to all surfaces in the element primitive.  If the element primitive being modified does not already exist in the FRED model (i.e. it was created in the script), an Update needs to be issued before this command is called.  This is required because the command acts on the surfaces of the element primitive that are created once the Update is issued.

 

Syntax

ElemAddScatter epNode, scatterID

 

Parameters

epNode As Long

Node number of the element primitive whose surfaces are being altered.
 

scatterID As Long

Node identifier of the scatter model to be added to all surfaces in the element primitive.  Scatter model identifiers are zero-based as they appear on the object tree of the FRED document.

 

Remarks

If invalid arguments are encountered the script will return an error message and operation is halted.  The following error messages may occur:

 

"Error: The specified node is not a primitive element."

Indicates that argument epNode is not an element primitive.

 

"Error: Invalid scatter index."

Indicates that argument scatterID is not a valid scatter model.  No scatter model exists in the FRED document with the supplied identifier.

 

Example

The following example references the node number of an existing Cube type element primitive, prints the number of parameters which define it and the parameter description, sets parameter with string name "a" (zero-based index identifier 0) to have a value of 3 using ElemGetParmValue, sets the materials 1 and 2 for all surfaces in the element primitive to be Air (0) and Simple Glass (2) using ElemSetMaterials, sets the coating for all surfaces in the element primitive to be Transmit (2) using ElemSetCoating, sets the raytrace control set for all surfaces in the element primitive to be Transmit Specular (1)  using ElemSetRaytraceCtrl and adds the Black Lambertian (0) scatter model to all surfaces in the element primitive using ElemAddScatter.

 

Sub Main

          epNode = FindFullName("Geometry.Cube")

          Print "epNode has " & ElemGetParmCount(epNode) & " parameters (zero based index)."

          For ii = 0 To ElemGetParmCount(epNode)-1

                              Print "Parameter index " & ii & " is " & ElemGetParmDescription(epNode, ii)

                              Print "Parameter index " & ii & " has string name " & Chr(34) & ElemGetParmName( epNode, ii ) & Chr(34)

          Next ii

          ElemSetParmValue epNode,"a", 3

          ElemSetMaterials epNode, 0, 2

          ElemSetCoating epNode, 2

          ElemSetRaytraceCtrl epNode, 1

                    ElemAddScatter epNode, 0

          Update

End Sub

 

The code above prints the following information to the output window:

 

epNode has 2 parameters (zero based index).                              

Parameter index 0 is Semi-aperture                              

Parameter index 0 has string name "a"

Parameter index 1 is Location of element origin                              

Parameter index 1 has string name "d"                              

 

See Also

Element Primitive Script Commands

Element Composite (boolean) Script Commands

 

 

 

 

 

Copyright © Photon Engineering, LLC