Grasshopper

algorithmic modeling for Rhino

Matching multiple items in tree to multiple branches in another tree

So I have two trees which look as so:

#1       #2

{0}    {0:0}

{1}    {0:1}

{2}    {0:2}

         {0:3}

         {1:0}

         {1:1}

         {1:2}
         {1:3}
         {2:0}
         {2:1}
         {2:2}
         {2:3}

Each branch has 10 points. I'd like all the points in {0} to draw lines to each sub-branch {0,#}, {1} to {1:#}, etc. I am simply confounded, how would this be accomplished?

Thanks!

Views: 921

Replies to This Discussion

Hello Shane,

this could be a way

a better version would find the "length" of the paths and set the duplication accordingly. this could enable working with data trees with non equal subbranches.

(perhaps a split tree with a list length etc)

cheers

alex

Thanks Alex, that worked great.

In the spirit of completionism, here is a way to set the path count automatically:

Thanks!

Great!

i deleted the screenshot file and i was wondering if this solution would work with the following

#1

{0}

{1}

{2}

to be matched with

#2

{0;0}

{0;1}

{0;2}

{1;0}

{1;1}

{1;2}

{1;3}

have you tried it with uneven subbranches?

cheers

alex

Hi i saw this thread by looking for something else...

But anyway,i guess here's another simple solution. Actually you can just path map all the branches {n;m} to {n}, then link your mapped branches and your simple branches {0},{1}..{n} to longest list component, set it to wrap. It will duplicate the whole list of your every simple branches depending on the number of items in mapped branch {n} to match with.

For exemple, for simple{0} you have [0,1,2,3,4], and for mapped {0} you have 15 items, the function will make your simple{0} to [0,1,2,3,4,0,1,2,3,4,0,1,2,3,4]

so len(simple{0}) =15 equals your len(mapped{0})

This means you dont have to count how many subbranches it has to duplicate your list.

Hope i made it clear. Best

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