MatchMaterial

Copies the material definition from one material to one or more objects.

Syntax

Rhino.MatchMaterial (intSrcMaterialIndex, strDestObject)

Rhino.MatchMaterial (strSrcObject, arrDestObjects)

Parameters

intSrcMaterialIndex

Required.  Number.  The zero-based source material index.

strSrcObject

Required.  String.  The identifier of the source object.  The object must have a material assigned.

strDestObject

Required.  String.  The identifier of the destination object.  If the object's material source is set to "By Layer", it will be changed to "By Object."

arrDestObjects

Required.  Array.  An array of destination object identifiers.  If the objects' material sources are set to "By Layer", they will be changed to "By Object."

Returns

Number

The number of object that were modified if successful.

Null

It not successful, or on error.

Example

Dim strObject, arrObjects

strObject = Rhino.GetObject("Select source object")

If Not IsNull(strObject) And (Rhino.ObjectMaterialIndex(strObject) > -1) Then

arrObjects = Rhino.GetObjects("Select destination objects")

If IsArray(arrObjects) Then

Rhino.MatchMaterial strObject, arrObjects

End If

End If

Also See

CopyMaterial

LayerMaterialIndex

ObjectMaterialIndex