Description This function assigns a scatter 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 = SetSurfsAssignScatter( scat, items(), recursive )
Parameters count (Long) Returned number of scatter model assignments that were made. Scatter models are only assigned to surfaces. Depending on the construction of the items() array and the use of the recursive option, the number of scatter model assignments made can be different from the number of items in the items() array.
scat As Long Node number of the scatter model that is being assigned.
items() As Long Node number of the items that the scatter model assignment should occur on. If an item is a surface, then the scatter model 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 scatter model 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 scatter model. If False, the scatter model 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
|