Orient curve

Hi everyone I’m trying to model a tunnel.
I created the tunnel section on the xy plane and orients it with z tangent to the curve. Then I do a loft between the sections.
At a certain point the rotations of the sections change drastically and I get an error as can be seen in the attached images.

I take it the sharp rotation itself is not supposed to be there. Likely it is caused by the lengthwise curve being put together from multiple smaller curves.

A possible solution to this is to rotate the planes so that their y-axis points ‘up’ (world z-axis). To do this:
-compute the angle between the local y axis and the world z
-rotate the planes by that angle around the local z

take a look at this:

Does the Perpendicular Frames component do what you want here? The way you define your planes by origin and normal leaves one degree of freedom undetermined, and Grasshopper decides it in a manner that causes those discontinuous flips.


Can you send me the gh file,Thanks,luozhongbin2015@gmail.com