Region Difference with curves with different z-value

I have list of closed curves with different z values. Some of the curves intersects each other when projected to xy plane. Every curve has only one z-value. In the areas where curves intersects in xy-plane I wan to do region difference to trim the curve with bigger z value with the curve with smaller z value.

I was thinking to project all the curves to the xy-plane, do the region difference there and then move the trimmed curves back to their original elevation. I think I need to some kind of loop to first test the region difference with the lowest curve and all the other curves and then test with the second lowest curve and all he remaining curves and so on. Any help with the loop?

Here is example of the situation. In the real situation there would be more curves and not all will intersect with anything. And some of them will intersect with multiple curves.

Thank you. This works for the three curves, but what if I have more of them and region difference should be done with more curves than just the bottom one?

trim.gh (11.9 KB)

Thanks again. In theory this should work, but I find the trim solid to be somewhat unstable and with hundreds of curves there sometimes are errors that I cant explain. Thats why I suggested the loop with curves and region difference because I thought that would work better.

no loop, no solids:
regionDifferenz_byZvalue_jvs_01.gh (27.9 KB)
just lists and datatree handling.

@Jakob_v_Schirmeister Thanks, it seems to work otherwise perfectly but for me it now works in wrong direction: it trims the lower curve with the upper curve, but i need the upper curve trimmed with lower curve. Are you able to switch it?

:blush:


regionDifferenz_byZvalue_jvs_02_listReversed.gh (29.6 KB)

1 Like

Maybe I should have figured that out myself… Thank you!