Tree restructuring - flip multi-matrix?

I think this might be an easy one - but it’s beyond me.

I’m taking 2 breps representing a building mass and dividing them into levels. At each level of the breps, I’ve created a plane respectively which I’m intersecting with the brep to get bounding curves (floor plate outline). I then want to take those surfaces and split them where they overlap. For this, I want to use SrfSplit, which takes a surface and splits it with a curve.

So: I’m using the SrfSplit component on a list of surfaces and a list of curves.

The lists are long, but to give you an idea, it’s like this:

Curves:
{0;0}
0.Curve A
{0;1}
0.Curve B
{1;0}
0.Curve C
{1;1}
0.Curve D
1.Curve D’

*Notice that the last branch has 2 items

Surfaces:

{0;0}
0.Srf A
{0;1}
0.Srf B
{1;0}
0.Srf C
{1;1}
0.Srf D

The first number in the tree represents which Brep the srf or crv is coming from, the second number is essentially which floor level it is within that brep.

So, what I want to do is combine all surfaces that are on the same floor level, regardless of which brep they’re in - same for curves. So, I want my data to be restructured like this:

Curves:
{0}
0.Curve A
1.Curve C
{1}
0.Curve B
1.Curve D
2.Curve D’

Surfaces:
{0}
0.Srf A
1.Srf C
{1}
0.Srf B
1.Srf D

That way I can limit intersections (computationally expensive) by floor… All of the surfaces in {0} will only intersect with all of the curves in {0}.

I’ve been using a few of the Human tools (I don’t know if these are only available at this firm or if they’re published) like Treefrog, in addition to the GH native tree tools. I just can’t figure out how to remap these branches the way I want them to. I want it to be flexible so that whether I input 1 brep or 2 or 5, or whether a branch contains 1 item or 2 or 5, it will consistently work.

I hope this makes sense and isn’t too much to ask!

Eike

It’s kind of like flip matrix, I think - but then for multiple branch locii or split at multple locii or something. I don’t know really.

What you need to make this simple is the magic Flip Last component from Tree Sloth I think. https://www.food4rhino.com/app/treesloth

Ahh, sweet I have that component, but had no idea what it did! Btw, I follow your IG - cool stuff, man!

1 Like

It almost works, but that gives me this:

The original structure is this:

That one branch that contains 2 items is the screwball.

Also, that appears to be structuring them by brep, rather than by level… In this instance I have 16 levels, so I would want 16 branches. It’s kind of the inverse of what flip last is giving me. Maybe I’m thinking about it wrong?

Does anyone have more ideas about this?

It’s been a while - anyone have any ideas with this?

I still can’t figure it out, and in the intervening time I still have not learned any coding to make my own component : ) . I rely on the genius of this community to build the nodes. I just arrange them.

This seems to work and matches your example:

Tree_Restructuring.gh (8.4 KB)

-Kevin

I’m not 100% sure I understand, but if your tree always has the same structure, and always has your levels on the second branch, you could user Path Mapper like so:

I would recommend testing it when you only give your script one Brep - since the first branch might collapse, depending on how you have scripted that previous bit. If it does happen, your levels wouldn’t be in the second branch, if you know what I mean.