17 October 2011

rh color scale attractor

This script apply a gradient color and scales an array of objects.

Option Explicit
Call Main()
Sub Main()
Dim object,attr,bottles,attr1,points,i,arrpoints
bottles= rhino.getobjects (" select bottles")

attr=rhino.getobject (" select attractor",1)
For i=0 To Ubound(bottles)

object=rhino.surfaceVolumecentroid (bottles(i))

Dim dist:dist= rhino.distance ( object(0), attr1)

Dim material5

material5 = rhino.AddMaterialToObject ( bottles(i))
Call rhino.MaterialColor (material5, rgb((dist*100)+10,(dist*30),(dist*60)+10))
Call rhino.MaterialShine (material5, 255)
Call rhino.ScaleObject (bottles(i),object(0),array(dist*0.5,dist*0.5,dist*0.5),False)

End Sub

0 commenti: