[Beginner] Calculation of Average slope along a projected curve

Hello everyone, new to Grasshopper here.

I’m working on a definition where I need to calculate average slopes across multiple curves that I’ve projected onto a surface, and I keep running into data structure issues, approach and genuinely think I need some help from you guys.

I’ve tried to explain what I wrote on the script so far:

I used Evaluate Curve to divide each projected curve onto a surface into a set number of points.
This gave me multiple branches (one for each curve) containing several points.
I then used List Shift (with Shift = 0, I suppose it has to be 1 but for some reason 0 gave me the desired result) to pair each point with its neighbor. Connected these lists into a Line component to create segments.

Used Deconstruct Point to get X, Y, and Z for each pair of points.
Calculated the vertical difference and the horizontal distance (run) by ignoring Z in the distance calculation. Then I used them to get the slope ratio, which I want to convert into either a percentage.

I tried using Graft and Flatten in different spots, but I’m still not sure how to ensure each curve is processed independently.

I want to average the slopes across all segments on each curve.

I’m attaching the grasshopper and rhino file on here.

Rise_Run.3dm (71.7 KB)
Rise_Run.gh (23.5 KB)

this could be an approach using Relative Item:

Rise_Run_inno.gh (41.3 KB)

1 Like

Another idea.
Rise_Run a.gh (29.2 KB)


1 Like

Thanks a lot for the solution! I’ll improve my script.

Thanks a lot! From having no idea how to proceed, now I have two alternatives. Cheers!