Description Sets material 1 and material 2 for all surfaces of an 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 ElemSetMaterials epNode, mat1, mat2
Parameters epNode As Long Node number of the element primitive whose surface properties are being modified.
mat1 As Long Material node identifier to be assigned as material 1 for all surfaces in the element primitive. Material node identifiers are zero-based as they appear on the object tree of the FRED document.
mat2 As Long Material node identifier to be assigned as material 2 for all surfaces in the element primitive. Material node 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 material number." Indicates that argument mat1 or mat2 is an invalid material identification number. No material exists in the FRED document with the referenced identification number.
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 ElemSetParmValue, 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
|