Copies the material definition from one material to one or more objects.
rhinoscriptsyntax.MatchMaterial (source, destination)
rhinoscript.material.MatchMaterial (source, destination)
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." |
Number |
The number of objects that were modified if successful. |
None |
It not successful, or on error. |
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 )