I built* this function months ago and use it pretty frequently - for example, when packing things of various known sizes along a curve, or when translating a design to meatspace (where the subtleties of varying arc lengths along a curve are just unnecessary complications). There are probably better ways of writing this code, but I think it's useful enough that something like it should be included by default in rhino.python.
def LinearDistAlongCurve(pathCurve, startPt, distance, tolerance = 0.1):"""Uses a binary search to find a point at a given linear distancealong a curve."""tmin = rs.CurveClosestPoint(pathCurve, startPt)tmax = rs.CurveDomain(pathCurve)t0 = tmint1 = tmaxendPt = rs.EvaluateCurve(pathCurve, tmax)maxDist = rs.Distance(startPt,endPt)if distance > maxDist: returnwhile True:t = 0.5 * (t0 + t1)tempPt = rs.EvaluateCurve(pathCurve,t)tempDist = rs.Distance(startPt, tempPt)if abs(tempDist - distance) < tolerance: breakif tempDist > distance: t1 = telse: t0 = treturn tempPt
Or maybe there's already a way to do this that I've missed?
*Copied and modified the code from a nearly identical but functionally different tutorial example on binary searches