Grasshopper

algorithmic modeling for Rhino

How to Match Multiple Branches to Specific Branches?

I have two lists.

List A has points in this order

{0;0},{0;1},{0;2},{1;0},{1;1},{1;2},{2;0},{2;1}

List B has surfaces in this order

{0}{1}{2}

I'm using a closest point on surface component but the problem is that I am inputting 8 points and getting 24 point out because grasshopper is matching every point to every surface. The correct way would be 3 points for surface {0}, 3 points for surface {1}, and 2 points for surface {2}.

Anyway, is there a way to say that every branch with a {0;?} should relate to the {0} surface, the {1;?} branches should match with the {1} surface, etc?

Views: 1020

Replies to This Discussion

Hi JS,

Use the "Shift paths" for your points data tree. That will convert your branches {0;0},{0;1},{0;2},{1;0},{1;1},{1;2},{2;0},{2;1} to {0},{1},{2} and will enable you to exactly match them with those of a surfaces.

Thanks djordje!

Hi Djordje,

Maybe you can help me out too.

I have two lists, X and Y, and they have as well a similar structure to the ones that JS showed.

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 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 you suggested "shift path" 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?

Er...I would suggest posting some definition to start with

PS: other than doing things via components ... generally speaking you can do anything you want via scripting or (to a lesser extent) via controlled iterations (say via Anemone).

How about using the trim tree (sort of undo graft) component on the points?

(can also be done with the graph mapper)

It'll kickbox the points to the order {0} (n=3), {1} (n=3) {2} (n =2), and you should be a happy camper.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service