Grasshopper

algorithmic modeling for Rhino

Simple Tree Structuring Question - Partition List for Branches

I have a data tree with thousands of branches. First n branches have x items each. Following n branches have y items each. Following n branches have z items each. How do I turn these branches into sub-branches, with n sub-branches in one main branch. I am looking to do the same as what Partition List does for a list, but instead of individual items, I need branches partitioned.  

Views: 920

Replies to This Discussion

So you have:

{0} N = 3

{1} N = 3

{2} N = 5

{3} N = 5

...

Where n=2, x=3 and y=5? And you want:

{0;0} N = 3

{0;1} N = 3

{1;0} N = 5

{1;1} N = 5

...

Or did I misunderstand?

Also, do you know n, x and y, or do you need GH to figure out these values at runtime?

That is exactly what I am looking for. n is known. x and y are not known but are unimportant. The number of base level branches (or the total number of initial branches) after transformation is not known, but there will be an even number of sub-branches in each branch.

Thank you.

Took me a while to figure this out since I had no idea which component to use and because I had no idea how path mapper works (that seems to be the component for the job!). Attached divides branches into groups of 2 (as per the notes above).

Attachments:

I should have used "floor" to make it more like David's example above. 

That is interesting. Now I have this question. How can you partition your lists in this way:

{0;0} N = 3

{0;1} N = 3

{1;0} N = 5

{1;1} N = 5

{2;0} N = 30

{2;1} N = 30

partition these six branches into three parts:

branch 1:

{0;0} N = 3

{0;1} N = 3

branch 2:

{1;0} N = 5

{1;1} N = 5

branch 3:

{2;0} N = 30

{2;1} N = 30

parthmapper won't change the length of branch, explode tree won't give me two branches in one output

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service