Grasshopper

algorithmic modeling for Rhino

How to combine branches where some items are of same value?

Good day GH friends,

Its already taking me days contemplating on this problem and yet still unsuccessful to come up with a solution.

I wish to combine the branches that share the same value in some of the items within a branch. Kindly refer to the snapshot below for better understanding of the goal i wish to achieve: All effort to help will be much appreciated - Homar

Views: 1953

Attachments:

Replies to This Discussion

Looks really tricky, because as you merge sets of values you have to deal with those new intermediate sets.

Are you interested only in integers, or also floating point number or other data types?

Hi David,
I need integers only.

I couldn't think of a nice way to do it using regular components... Had to resort to C#.

Attachments:

Thank you very much David. The C# is the last piece for my work puzzle.

BR,

Homar

Hello Homar,

You can use the "set union" and "set intersection" components to achieve what you want.

1- With the "set intersection" component you can check if there is a common value between two branches of the tree.

2- If the above is true, then you can "set union" both branches (that you have already checked)

PS: this might be a repetitive process, however you can do it once and add it in a cluster and then use the cluster for the repetitions.

Check the attached image.

Cheers ..

Attachments:

Hi Ibrahim,

Thank you for your help and time in this problem of mine. For now David's solution is best for my work now.

BR,

Homar

Of course David have always the better way to do it ..

My way using regular components was not that much nice and general ..

I will look more deeply into your approach, I'm just occupied at the moment. I notice that there is a VB component in the image. What's inside that VB?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service