MatchMaterial

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

Syntax

rhinoscriptsyntax.MatchMaterial (source, destination)

rhinoscript.material.MatchMaterial (source, destination)

Parameters

source

Required.  Number.  The zero-based source material index. -or- String or Guid.  The identifier of the source object.  The object must have a material assigned.

destination

Required.  String or Guid, or List of strings or Guids.  The identifier(s) of the destination object(s).  If the object's material source is set to "By Layer", it will be changed to "By Object."

Returns

Number

The number of objects that were modified if successful.

None

It not successful, or on error.

Example

import rhinoscriptsyntax as rs

obj = rs.GetObject("Select source object")

if obj and rs.ObjectMaterialIndex(obj)>-1:

    objects = rs.GetObjects("Select destination objects")

    if objects: rs.MatchMaterial( obj, objects )

Also See

CopyMaterial

LayerMaterialIndex

ObjectMaterialIndex