Grasshopper

algorithmic modeling for Rhino

How to apply a data tree structure to a flat structure

Hi

I am struggling with the path/branches.

I have two sets of data with the same amount of points. First data structure is flat with only one path of 2244 points, second is structured by 204 path each containing 11 points. What I would like is to apply the data structure of the second list with the 204 path to the datas of the first list.
I guess it should be possible when the amount of items in the structures are the same.?

I hope you can help me out

Stig

Views: 2009

Attachments:

Replies to This Discussion

Going one way is easy, just flatten the 204 lists. Either use a Flatten component or toggle the Flatten option on any parameter that receives the data. Going the other way (i.e. converting your list of 2244 items into 204 lists of 11 items each) is more complicated but also possible.

--
David Rutten
david@mcneel.com
Poprad, Slovakia

Hi,

 

I've been dealing with a similar problem, but haven't found a solution from the forums. Sorry for no images, the definition is currently at a different location.

 

How about if the lists aren't the same length, but the total length of items is the same. Consider the following flat lists (short for convinience):

L1: A B C D E F G H and L2: 0 0 0 1 2 2 2 3. L1 could be a list of strings or numbers, L2 defines a category. The end result should be {0;0} A {0;1} B {0;2} C {1;0} D {2;0} E {2;1} F {2;2} G {3;0} H

Using L2 getting the target paths, or even the index where the first list should be splitted, is fairly simple.

However, I just can't find a component that can divide L1 accordingly. In order it to be useful for longer lists and larger set of categories, the solution should not rely on an array of components for each branch.

I am not totally sure I understand your question, but perhaps this answers it :

Thank you!

 

That's exactly what I was looking for. Though, I had to update GH from an ancient version. Seems like the Replace component worked differently before.

how about something like using a graft/weave combination on the 1D list. you shoul be able to extract a mask pattern from your multidimensional list... (list lenght as input into a list component)
Hi Jes and David, I need to go the troublesome road, but what your are suggesting Jes make sense, thanks for that, I will try that out.

I did hope that there was a more simple way to do it,,
Hi,
Normally it’s a problem.
But if you have the same amount of elements on each path,
what I normally do is a series of a series, like the example.

Regards,
Carlos
Attachments:
Hi Carlos,
I just went through your example, seams to work very well, I will try it out tonight.
Tanks a lot!
It works !! , very simple and nice,,, great
Hi all, before 06.0055 I used to apply Carlos' method, but I wanted to give a try to the path mapper component, which seems to be perfect for these issues. I eventually succeeded although I did not understand why I had to apply a strange "-5" to the destination formula (see attached image)... anybody has a clue?

Alessio
Attachments:
This must be a bug because its true for dividing by all odd numbers:
(i-1)/3
(i-2)/5
(i-3)/7
(i-4)/9
(i-5)/11
....
(i-n)/2n+1

And you can't make it work for even numbers
Hey, pretty cool Path Mapper!! I didn’t noticed.
Thanks!

Stigvg, you welcome.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service