Grasshopper

algorithmic modeling for Rhino

Hello all,

I have been struggling to filter one array generating another that contains arrays. I have tried to do my homework and even though the dog did not eat it I haven't managed to find a solution here at the forum or by myself. It seems I have followed the same logic as the code on page 132 of the Grasshopper Primer second edition without any success on my component's output. Well the code currently is as it follows:

Sub RunScript(ByVal ArrPoints As List(Of On3dPoint), ByVal SecurityDistance As Double)
'''
A = New List (Of On3dPoint)
Dim _A As New List (Of on3dPoint)
Dim Arr2d_Columns As New ArrayList
ArrayOfColumns = New ArrayList

Dim i As Integer
For i = 0 To (ArrPoints.count - 1)
Dim CurrPt As New On3dPoint : CurrPt = ArrPoints(i)

Dim j As Integer
For j = 0 To (ArrPoints.count - 1)
Dim CheckPt As New On3dPoint : CheckPt = ArrPoints(j)

If i <> j
Dim MyDistance As Double
MyDistance = ((currPt.x - checkPt.x) ^ 2 + (currPt.y - checkPt.y) ^ 2) ^ 0.5

Dim ArrColumn As New List (Of on3dPoint)
If i = 0 Then ArrColumn.Add(CurrPt)

If MyDistance > SecurityDistance Then
Dim MyDistanceX As Double
MyDistanceX = Abs(currPt.x - checkPt.x)
If MyDistanceX < SecurityDistance Then ArrColumn.Add(CheckPt)
End If
Arr2d_Columns.Add(ArrColumn)

End If

Next

Next


ArrayOfColumns = Arr2d_Columns



'''
End Sub

#Region "Additional methods and Type declarations"

#End Region
End Class

It is still missing a couple of comparisons to be built, anyway the issue that I want to stress here is how can I output a nested array (should it be called Data Tree?) in a component? If anyone could give me some directions that would be great.

Thanks!

Guimas.

Views: 945

Replies to This Discussion

Hi Guimas,
Please see attached definition, it has two samples. In the first, I modified your code slightly to output your array of arrays, however you can only use this as input to other VB components.
To use output as input to other GH components, you need to output a datatree, the second sample does just that.
Let me know how that works for you.
Attachments:
Hi Rajaa
I have still problem with using ArrayList as input to another VB node. When data is going from first VB its sing like Sys.coll.G.List(of..). i think its correct, but when i used it like intup to second VB is it sing like EH_objectWrapper. What i can do with this type? How i can call same array structure like in first VB? .. aa(0)(10) etc.

PLease some tips. Thank a lot
Joach
Hi Rajaa

I just tried to input a datatree created that way into another VB node. The following code doesn't work:

Dim t() As Int32 = New Int32(){0,0,0}
Dim br As New EH_Path(t)
A = P.Branch(br)

P is the input datatree (ByVal P As Object). The path 0:0:0 exists, it works if i try to access it via the GH nodes. There is no output for runtime errors, so i guess i just misunderstood sth. Can you help me out?
Hi Rajaa,

Thank you for taking the time to reply, and thank you for Panelling Tools as well! Unfortunatelly I was unable to get your file running as I got IO generated messages on it. Would you mind by posting the file again?

Many Thanks.

Guimas.
Hi Rajaa,

Thanks again, I managed to make it work. I was getting just the last stable version of GH, guess I am not that adventurous...
Wahwahweewah! all my grouped icons got messy with this version...

It works although I feel like searching something in my wife's purse, where is my wallet? Here I found your slider!

Are all groups gone for good?

Not complaining, just saying...

Thanks to all.

BTW; the aligning icon tools are awesome.

Guimas.
Hi Guimas,

Glad it worked.
I use 0.6.018 and i should have mentioned that. I haven't used the 0.5 version for a while and icons/tools/components locations might have changed a bit. You'll get used to it fast :)
Clusters have been taken out since I was cleaning out the core and it was impossible to maintain the old cluster objects. They'll re-emerge at some point (they're pretty high priority) and hopefully they will be much more versatile and useful then.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service