Grouping Branches Problem

Hi!

Maybe this is more simple that it sound:

I have a set of 13 surfaces that represent land lots. Two of them are divided by roads, so it looks like there were four. I am trying to rearrange the branches of the tree so it would have one branch for every complete plot, meaning that there should be only 11 branches (9 coantaining 1 surface and 2 containing 2 each).
I have assigned different numbers to every plot to identify them, repeating only when needed, so i can extract and rearrange the indexes and group them in branches accordingly. It seems to work in terms of the indexes, but i have not been able to construct a new tree with the new branches.

In the end, I need to extract the areas of the plots and be able to manage them as a complete entities.

Thanks

Grouping branches problems.3dm (28.1 KB) Grouping branches problems.gh (133.2 KB)

You have internalized your “Lands” so no need for Rhino file?

I wonder if there is something wrong with your list of indices because the two divided lots I found are not adjacent to each other?


Grouping branches_2020Sep11a.gh (142.1 KB)

P.S. The PLine (yellow group below) connects the area centroids of “adjacent” ‘Lands’, which don’t appear to be adjacent to me?

I replaced the Gradient with random colors (purple group) that make the distinction between branches more explicit. Same code otherwise.


Grouping branches_2020Sep11b2.gh (148.3 KB)

1 Like

Looking again at the image in your original post, the list of indices that match those two pairs is as follows? Makes more sense.


Grouping branches_2020Sep11c.gh (146.3 KB)

Sorry I didn’t take the time to fix that before.

1 Like

Thank you!!! :smiley: :smiley: :smiley:

In the model, the order of the “lands” is given by the “Y” value of the centroid. So they go from top to bottom. That gives one index number list. Then, I created a second list, with indexes of “groups”:

The first Item goes to> First Group
Second Item > Second group
Third Item > Third group
but Five item >Third group
And so on…

you get the idea

Then I used both lists to get the right order :slightly_smiling_face:

Would you, please, explain to me this function?:

Grouping branches_2020Sep11_NEW.gh (138.1 KB)

Beatiful!

I was writing when you posted :sweat_smile:

Thank you x1000

Remove it and see the difference?

I’m not following “the “Y” value of the centroid” thing, sorry. It’s the group index value that matters for matching two parts of the same lot.

I was looking your definition and is more simple than the one I posted. So yours is better.

Why do you use 2 “CSET”? (Just trying to understand the logic)

It’s a Member Index pattern, very useful for many things. Explained here:

Yes. But I gave it that order before. Otherwise it is random.

I can see what it does, but, again, I wanted to understand the logic in the structure of the expression
:slightly_smiling_face:

It is adapted from the default Expression component (Maths | Script | Expression) using only one value instead of two and rounding the value to two decimal places.

expression