Grasshopper

algorithmic modeling for Rhino

Can someone show me how to set up a data recorder (for any type of data), with a boolean input for reset in Vb.net?

Views: 4276

Replies to This Discussion

Private Sub RunScript(ByVal d As Object, ByVal r As Boolean, ByRef A As Object)

If r = True Then
out_list.clear
Else
out_list.Add(d)
End If

A = out_list

End Sub

'<Custom additional code>

Dim out_list As New List(Of Object)

'</Custom additional code>
End Class

Fantastic! Thanks a lot, David.

Sorry, one more thing:

I´d like to have the behaviour the same as with the standart component.

So after reset it will output an empty list instead of the latest data provided.

And more important, it needs to follow the tree structure. How to fix this?

This one is closer...not exact in terms of use, as the native component recognizes when the input values change, and I'm not familiar with how it does that.  Use a boolean toggle for record, and the button for reset.

Private Sub RunScript(ByVal d As DataTree(Of Object), ByVal record As Boolean, ByVal reset As Object, ByRef A As Object)

If reset = True Then
out_tree.clear
ElseIf record = true then
For Each p As GH_Path In d.Paths
Dim out_list As List(Of Object) = d.Branch(p)
out_tree.AddRange(out_list, New GH_Path(p))
Next
End If

A = out_tree

End Sub

'<Custom additional code>

Dim out_tree As New DataTree(Of Object)

'</Custom additional code>

Left out the record part, since it didn´t really help. Would be interesting to get to known Davids (the other one) method for this.

Everything else is exaclty what I was looking for.

I think I got a little closer to understand some things better now.

Thank you!

I would do the same as David suggested. As you suggested, there is no need for the "record" parameter. "Setting the "reset" toggle to "true" clears all values, setting it to false again, starts recording.

------

Private Sub RunScript(ByVal data As DataTree(Of Object), ByVal reset As Boolean, ByRef Rec As Object)


If reset = True Then
  out_tree.clear
Else
  For Each p As GH_Path In data.Paths
    Dim out_list As List(Of Object) = data.Branch(p)
    out_tree.AddRange(out_list, New GH_Path(p))
  Next
End If

Rec = out_tree
End Sub

'<Custom additional code>
Dim out_tree As New DataTree(Of Object)
'</Custom additional code>

well...I only added it the second time in order to approximate the existing component...the record/reset parameters are there in order to be able to stop recording without removing the current output...:)

Hello David,

how could this component store custom data types like volvox point cloud?

best

alex

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service