Grasshopper

algorithmic modeling for Rhino

Match branched lists ?! List management problem

Hey guys,

I have a list management issue.

I have two lists, X and Y:

X is made of {0;0} (N=1), {0,1}(N=1)...{0,15}(N=1), {1;0}(N=1), {1,1}(N=1)...{1,15}(N=1). While Y is made of {0}(N=6), {1}(N=15).

What I need to do, is to cycle through all the branched items of the X lists with every single item of the corresponding list of Y.

So:

{0,0}(N=1) with 1st item of Y{0},

{0,1}(N=1) with 1st item of Y{0}

... 

{0,15}(N=1) with 1st item of Y{0} (and this is the first cycle).

Then (cycle 2)

{0,0}(N=1) with 2nd item of Y{0},

{0,1}(N=1) with 2nd item of Y{0}

... 

{0,15}(N=1) with 2nd item of Y{0} 

Then do the same thing with the X list {1,0} .. {1,15} with the corresponding Y{1}

As a result I need to have the following list structure:

{0,0}N=6, {0,1}N=6, {0,2}N=6 ... {0,15}N=6, 

{1,0}N=15, {1,1}N=15, {1,2}N=15 ... {0,15}N=15.

If I use the component "shift path" (as suggested in another discussion) it will match the items per item-order instead of cycling through all the items of the first sublist...

Hope this makes sense.

Any suggestion?

Views: 537

Replies to This Discussion

Hello

i am trying to understand what you mean when you say cycle. you get the first branch {0;0} of the x tree, which is a value since it has N=1 and you want to do something with the first branch {0} of the y tree which has 6 values. and then the same with the others. your end result is a tree that the {0;?} branches have 6 values each. so what happens to first value? you don't merge them, because then you would have 7 values in each branch. so how do you filter out one value? smaller larger comparison?

maybe i am missing something obvious.

cheers

alex

edit or you want for example to create a line from {0;0} N=1 to the all the others in {0} N=6 ?

Hi Alex,

Thanks for the reply. With "cycle" I mean the application of each item of the Ylists to all the items of its corresponding branch in Xlist. So if in the Y list in branch {0} I have 6 items, then the each element of the corresponding X branch list will be repeated 6 times >> basically the output list would have the same structure of the input Xlist but instead of having only one item per branch I would have 6 items per branch >> 

{0,0}N=6, {0,1}N=6, {0,2}N=6 ... {0,15}N=6, 

{1,0}N=15, {1,1}N=15, {1,2}N=15 ... {0,15}N=15.

I made a quick example of my problem, here attached.

Attachments:

i cant think of a better way at the moment, but surely there must be one.

It this what you mean?

Attachments:

Yes Arend! 

That's exactly what I need! I managed to make a workaround by duplicating the data of one list and stacking the other one, but this one is def quicker!

Thank you ng5 Alex as well for your time

cheers

L

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