Navigation: Scripting Reference Manual > Functions & Subroutines > SetSurfsAssignCoating

 

SetSurfsAssignCoating

 

Contact Us: fredsupport@photonengr.com

 

Description

This function assigns a coating model to multiple surfaces.  The surfaces can be either explicitly defined in an array argument or be implied by the array arguments through use of the recursive option.  An Update command should be issued after calling this function (doesn't have to be immediately after, but before the script finishes execution) to ensure that the assignments have fully propagated through the object tree.

 

 

Syntax

count = SetSurfsAssignCoating( coat, items(), recursive )

 

 

Parameters

count (Long)

Returned number of coating assignments that were made.  Coatings are only assigned to surfaces.  Depending on the construction of the items() array and the use of the recursive option, the number of coating assignments made can be different from the number of items in the items() array.

 

coat As Long

Node number of the coating that is being assigned.

 

items() As Long

Node number of the items that the coating assignment should occur on.  If an item is a surface, then the coating is assigned to the surface.  If an item is not a surface and the recursive argument is set to False, then the item is ignored.  If an item is not a surface and the recursive argument is set to True, then the coating is assigned to any surfaces which are descended from the item.

 

recursive As Boolean

If True, any surfaces descended from a node in the items() array will be assigned the coating.  If False, the coating is only assigned to a surface if the surface is specified in the items() array.

 

 

Example

The example below retrieves a list of items which have been assigned the "Design Path" keyword, then assigns all of these items a coating, raytrace control scatter model and two materials.

 

Sub Main

 

    'Construct array of keywords

    Dim kws(0) As Long

    kws(0) = KeywordFind( "Design Path" )

 

    'Construct array of items having keywords of interest

    Dim items() As Long

    KeywordsGetAppliedItems( "ent", kws(), items() )

 

    'Assign desired properties to retrieved items

    Dim coat As Long, mat1 As Long, mat2 As Long

    Dim rctrl As Long, scat As Long

    coat  = FindCoating( "Gold Thin Film" )

    rctrl = FindRaytraceCtrl( "Reflective Optics" )

    mat1  = FindMaterial( "Al" )

    mat2  = FindMaterial( "Air" )

    scat  = FindScatter( "Harvey Shack" )

    SetSurfsAssignCoating( coat, items(), False )

    SetSurfsAssignRaytraceCtrl( rctrl, items(), False )

    SetSurfsAssignMaterials( mat1, mat2, items(), False )

    SetSurfsAssignScatter( scat, items(), False )

 

End Sub

 

See Also

Surface Scripting Commands

 

 

 

 

 

Copyright © Photon Engineering, LLC