Grasshopper

algorithmic modeling for Rhino

Hey guys,

I am trying to write a script which changes an objects material color.  Then when the object is baked into rhino, the material will retain this color, so it shows up when I render the object.  

Here is my script:

Private Sub RunScript(ByVal Geom As List(Of System.Object), ByVal Color As List(Of Color), ByVal Activate As Boolean, ByRef A As Object)

If (Activate)


For i As int32=0 To Geom.Count() - 1

Dim att As Rhino.DocObjects.ObjectAttributes = New Rhino.DocObjects.ObjectAttributes()

Dim mTemp As Rhino.DocObjects.Material

mTemp.DiffuseColor = color(i)

doc.Materials.Add(mtemp)

att.MaterialSource = Rhino.DocObjects.ObjectMaterialSource.MaterialFromObject

doc.Objects.AddSurface(Geom(i), att)


Next

End If


a = geom

Any help will be greatly appreciated.

Thanks

Views: 1110

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2025   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service