Returns or modifies the rendering material source of an object.
Rendering materials are stored in Rhino's rendering material table. This table is conceptually an array. Render materials associated with objects and layers are specified by zero based indices into this array.
The index of the render material used to render an object is specified in one of three ways:
Material from layer. The rendering material assigned to the layer is used.
Material from object. The rendering material assigned to the object is used.
Material from parent. For objects with parents, like objects in block instances, use parent's material. If no parent, treats as material from layer.
The default rendering material source for new objects is "material by layer."
rhinoscriptsyntax.ObjectMaterialSource ( object_ids, source=None )
rhinoscript.object.ObjectMaterialSource ( object_ids, source=None )
object_ids |
Required. String, Guid, or list of Strings or Guids. The identifier of the objects. |
||||||||||
source |
Optional. Number. The new rendering material source. If omitted, the current material source is returned. Note, if object_ids is for more than one object, source is required.
|
Number |
If a rendering material source is not specified, the current rendering material source if successful. |
Number |
If a rendering material source is specified, the previous rendering material source if successful. |
Number |
If object_ids is for multiple objects, then the number of objects modified if successful. |
import rhinoscriptsyntax as rs
objects = rs.GetObjects("Select objects to reset rendering material source")
if objects:
[rs.ObjectMaterialSource(obj, 0) for obj in objects]