Having rectangles in the same plane as a curve, with multiple curves

Hello,

I hope I can make my issue clear to you.
I projected a lot of rectangles based on some curves, and I want them to have the same direction (plane) as the curve they are projected on, like in the picture. There is an error somewhere in the script, but I’m absolutely clueless. Has somebody got an idea?

Thanks in advance.

Rectangle problem.gh (17.4 KB)

the problem is on the very beginning of the definition
you have 3 branches each containing 37 points, and are looking for the SurfaceClosestPoint providing a list of 4 surfaces:

when you ask a component to do relative operations on two lists of different length, GH will just replicate the last item in the shortest list until every item in the longest list has a match

so, in this case:

Branch {0}
point_at_index_0 β†’ surface_at_index_0 β†’ find closest point
point_at_index_1 β†’ surface_at_index_1 β†’ find closest point
point_at_index_2 β†’ surface_at_index_2 β†’ find closest point
point_at_index_3 β†’ surface_at_index_3 β†’ find closest point
point_at_index_4 β†’ surface_at_index_3 β†’ find closest point
point_at_index_5 β†’ surface_at_index_3 β†’ find closest point
…
point_at_index_36 β†’ surface_at_index_3 β†’ find closest point

of course the same happens for Branches {1} and {2}

this concept is clearer with a PointList:


something like this can reorganize the data in such a way points are branched depending on the surface they are projected into (don’t know if this is what you’re looking for…)


Rectangle problem_Re.gh (25.6 KB)

the only important thing is that data is organized consistently, expecially when you perform operations that are based on relations

2 Likes

I see what I did wrong in the first place. Organizing this data is quite crucial indeed. Your solution is working by the way. Thanks for helping!

1 Like

Inno,

Just took a better look at this, and I think there is an error in here.

It looks like the rectangles are not aligned with the curve. I think that the frame does not align with the direction of the curve. Is there any reason for this?

I have no idea of what happens in the definition after the part that I did show you, I stopped looking after the very beginning