Grasshopper

algorithmic modeling for Rhino

hi all !

i have a quick answer... 

Does anybody know any way of transform a flatten list of object into another new data tree with the same object but "copying" another tree? boths trees have the same amount of total items, so, looking at the attached image, the output would be a new list with 

{0}

0 Closed Brep

1 Closed Brep

{2}

0 Closed Brep

1 Closed Brep

{3}

0 Closed Brep

1 Closed Brep

{5}

0 Closed Brep

1 Closed Brep

{6}

0 Closed Brep

1 Closed Brep

2 Closed Brep

3 Closed Brep

4 Closed Brep

5 Closed Brep

6 Closed Brep

7 Closed Brep

8 Closed Brep

9 Closed Brep

10 Closed Brep

11 Closed Brep

12 Closed Brep

13 Closed Brep

14 Closed Brep

15 Closed Brep

thanks!!

Views: 888

Replies to This Discussion

Unflatten tree does this.

i know David, but that info came from a closed add-on (packrat) and I cant go inside that code to change it...

I did this, but I need to keep the original path numbers instead of 0, 1, 2, 3...

Hmm...I mean, it looks like you have one flat list, and one with data structure that you want to impose on the flat list...if the total number of items in each is of equal length, then unflatten tree should do the trick. It shouldn't matter where it comes from...plug your flat list into the T input, and the list with data structure into the the G input, and your flat list structure will be matched.

thanks David, 

But due to the next stepts of the (huge) definition I need to keep using the tree structure. That could works if that would be the end part, but this is not the case...

Can you post internalized data. It would be easier to show you I think.

oh... i got it!

i just added a small trick!! :D

Unflatten does the exact same thing!

Unflatten is not from an add-on, it is a native component in GH. As David says, it does exactly what you are trying to do with a single component. 

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