So -
One:
The Help link for the method says this:
ObjectMaterialIndex Returns or an object's rendering material index.
The “or” is either wrong here, or “or changes” is what it’s supposed to read.
(there are a couple of entries like this, probably a copy/paste error)
Two:
The actual Help page says this:
Returns the material index of an object.
OK, so no actual mention of the possibility to “set” or “change” the material index of the object here…
But:
Three:
Object.py says this in its docstring for the method:
Returns or changes the material index of an object...
and it seems like the method is able to accept two arguments.
And, the following actually works - in Windows Rhino:
import rhinoscriptsyntax as rs
import scriptcontext as sc
msg="Select objects to reset to default material"
objs=rs.GetObjects(msg,preselect=True)
for obj in objs:
rs.ObjectMaterialIndex(obj,-1)
sc.doc.Views.Redraw()
The object changes back to the default material.
But:
This fails on MacRhino, where it tells me that I can only supply one argument to the method…
Thanks, --Mitch