Grasshopper

algorithmic modeling for Rhino

Hi all,

I've been trying to animate a grasshopper slider with Vray, and followed this discussion with some success:

However, there are multiple BREP objects, and the vb script only renders each one individually.  I found a hack to the initial vb rendering script:

 Private Sub RunScript(ByVal Geometry As OnBrep, ByVal Slider As String, ByVal Toggle As Boolean) 
    If (toggle = False) Then
      Print("gate not open")
      Return
    End If

    Dim i As New Integer
    Dim Geometry_i As New OnBrep
    Dim count As New Integer
    count = Geometry.Count()
    Dim obj_list As New List(Of IRhinoBrepObject)

    For i = 0 To count - 1
      Geometry_i = Geometry(i)
      Dim obj As IRhinoBrepObject = doc.AddBrepObject(Geometry_i)
      obj_list.Add(obj)
      doc.Regen()
    Next

    Dim filename As String = "C:\Documents and Settings\Lian\Desktop\GH_Animation\frame" & Slider & ".jpg"
    app.RunScript("-_Render")
    app.RunScript("-_SaveRenderWindowAs " & Chr(34) & filename & Chr(34))
    app.RunScript("-_CloseRenderWindow")
    For i = 0 To count - 1
      doc.DeleteObject(New MRhinoObjRef(obj_list(i)), True, True)
    Next

  End Sub

But this generates the following errors:
--'Count' is not a member of 'RMA.OpenNURBS.OnBrep'
--Class 'RMA.OpenNURBS.OnBrep' cannot be indexed because it has no default property.

I am not sure how to troubleshoot these items...  can anyone assist??

Thanks!
Lian

Views: 516

Replies to This Discussion

You need to enable the List option on the Brep input parameter. Then, instead of a single OnBrep you'll get a List(Of OnBrep).

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thanks, David, that seemed to do the trick! You are so helpful :)

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service