RhinoScript - Slope Ratio Calculation

Hi All, I have been working with Grasshopper to calculate the slope of lines that deviate from a true horizontal reference line. Now I am wanting to obtain the same type of functionality using a RhinoScript.
Basically, I am wanting to be able to select 2 points and the script can produce the required geometry and perform the calculation, including all associated text annotation.

The Text Annotations would be: SLOPE RATIO = 1:XX

I am hoping the diagram will assist with explaining the issue in a little more detail.

Does anyone know how this can be done? Is there a script like this already?

@m.wilson Have a look at this.

Maybe this helps you

Thanks Su, I guess this is more a flexible analysis tools looking at producing optimised design solutions. I am looking to move from Grasshopper to a RhinoScript where I can just click a custom button and it then produces the Value (Slope Ratio Annotation) as it is doesn’t require flexibility. Many thanks for the reference all the same, as it is an interesting case study!