Grasshopper

algorithmic modeling for Rhino

Hi,

I was wondering if anyone can tell me why what i am trying to do isn't working....

I am trying to connect the adjacent points within groups with a line. 

I have generated the index numbers i need for each line as a tree branch. The groups themselves are a higher level tree branch each.

I am getting the correct number of lines but  one between the correct points (duplicates instead) ie the mapping isn't working.

Can someone explain this/ give me rules of thumb to follow? I have tree issues often...

Thank you so much

Ken  

Views: 351

Attachments:

Replies to This Discussion

Hi Ken,

not sure, but isn´t it this what you want to do? No tree mod necessary.

Best, p

Hi Phillip,

Yes this is effectively what I wanted to to but at that time I was testing that my mapping worked because I was going to do something with arcs later. My real issue is that I cannot understand why the mapping didnt work anyway. I sort of need an explanation on why it didnt take the groups path and only apply the list items that were generated for that list - like why group {1,0} doesnt only just run list items {1,0}{1,1}{1,2}{1,3} and not the lists {2,0}.....(2,4} you know.....?

But you make a good point I really should diversify the components I use since your solution moves me forward with the correct mapping maintained! Just curious about lists - its my Achilles heel.

Ken 

Well, its because you are matching your 7 branches of points {a} with 26 branches of indices {a;b}, which does not work the way you would like it, because auto-matching behaviour is relying on lists rather than on the tree...

Two ways to solve this, either shift down the higher structure and partition afterwards (which does not really work in your case) or duplicate the points to the tree structure of the indices. {a}-->{a;b}.

This can be done with some effort or my all-time-favourite-VB-tree-mod:

  Private Sub RunScript(ByVal d As DataTree(Of System.Object), ByVal m As DataTree(Of System.Object), ByRef mD As Object)
    Dim dt As New datatree(Of Object)
    For j As Integer = 0 To m.BranchCount - 1
      For i As Integer = 0 To d.BranchCount - 1
        If m.Path(j).IsAncestor(d.Path(i), 0) Then
          dt.addrange(d.Branch(i).ToArray, m.Path(j))
          Exit For
        End If
      Next
    Next
    mD = dt
  End Sub

Best, p

also see here:

http://www.grasshopper3d.com/forum/topics/data-tree-matching

Attachments:

Sorry, credits again to Vicente Soler.

(How many times more do I have to post this solution, until it will become a native component finally?)

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service