Setting material reflectivity through Python


#1

Maybe I’m just not seeing it, but is there a Python method to set material reflectivity?

Thanks,

Dan


#2

Hi Dan,

Looks like the reflectivity value is the only one missing in rhinoscript syntax, don’t know why…

Shooting in the dark here a bit, but the following seems to work:

import scriptcontext as sc

mats=sc.doc.Materials
for i in range(mats.Count):
    if mats[i].Name=="MaterialToChange":
        newMat=mats[i]
        newMat.Reflectivity=100
        sc.doc.Materials.Modify(newMat,i,True)
sc.doc.Views.Redraw()

Not 100% sure this is the correct way to do this though.

–Mitch


#3

At least it’s good to know I’m not blind!! :smiley:

Thanks Mitch. I’ll see if that will work for me.

Dan