Roadlike Sweep on Compound Angles

Hello, I’m attempting to make a simple script where I can define a path curve and sweep it with 2 I-Beam sections. I’ve gotten it most of the way there I’ve been following this post and it works well for curves that are only angled in one plane, but as soon as I try to rotate the curve in 2 planes, it produces some undesirable results. I’ve included a bake of the geometry to show what I would like to produce.

Does anyone have any advice on how to solve this issue? I know I can just take the reference line and orient it so it’s not angled, baked the geometry, and then rotate it back, but for the sake of learning, I’d like to know how I could do it through grasshopper only.

Thank you in advance for your help

i beam sweep.3dm (41.6 KB)
I beam (17.4 KB)

Curve Frames behave differently when the curve is differently oriented, maybe a bug. The attached works better (with a single line python component to get Perpendicular frames)
I beam (18.7 KB)