Grasshopper

algorithmic modeling for Rhino

hi all
coming back to old topics, of baking colors into curves.

i tried old forum's baking script, from damien_alomar, which is working fine for curves and breps..but.
i wonder how to set the color not to the material but rather to the object itself, to the curve itself.
thx

Sub RunScript(ByVal blnBake As Boolean, ByVal material As Object, ByVal obj As OnCurve)
If blnBake Then

'Bake Object
Dim mC As New MRhinoCurveObject
mC = doc.AddCurveObject(obj)

'Set Material
Dim att As New MRhinoObjectAttributes(mC.Attributes())
att.setmaterialsource(1)
att.m_material_index = doc.m_material_table.AddMaterial(material)

'Modify the attributes
Dim objref As New MRhinoObjRef(mC.Attributes.m_uuid)
doc.ModifyObjectAttributes(objref, att)

End If
End Sub

Views: 536

Replies to This Discussion

hi enrique

below the vbdotnet text ( thanks to piac www.giuliopiacentino.com/grasshopper-tools/ an his great c# tools )

Dim internalCOlor As OnColor = OnColor.FromColor(color)
att.SetColorSource(IOn.object_color_source.color_from_object) 'Make the color type "by object"
att.m_color = internalCOlor
att.SetPlotColorSource(IOn.plot_color_source.plot_color_from_object) 'Make the plot color type "by object"
att.m_plot_color = internalCOlor

best to]
by the way byval color as object
Thanks a lot Thomas!!
i'll send you soon some things...
:)

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service