The straight distance between a and b is around 11.453, but i need to know distance between a and b on curve, i.e., (10.484 + 15.629) around 26.113 ( that is blue + yellow). Is there any python function to find that ?. Please find the attached cad file for reference. Thank you
Here I wrote a simple script that can do what you want:
import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
curve = rs.GetCurveObject("Select a curve")[0]
pt1 = rs.GetPointOnCurve(curve, "Select first point")
pt2 = rs.GetPointOnCurve(curve, "Select second point")
a = rs.CurveClosestPoint(curve, pt1)
b = rs.CurveClosestPoint(curve, pt2)
if a > b:
a , b = b , a
distance = rg.Curve.GetLength(rs.coercecurve(curve), rg.Interval(a, b))
print "d1 = " + str(distance)
if rs.IsCurveClosed(curve):
print "d2 = " + str(rs.CurveLength(curve) - distance)