/// <summary> /// Move a point or list of points along a curve based on a parameter witin a range /// </summary> /// <param name="point"></param> /// <param name="polycurve"></param> /// <param name="length"></param> /// <param name="param"></param> /// <search></search> public static dynamic MoveAlongCurve(this DSGeom.Point point, DSGeom.PolyCurve polycurve, double length, double param) { if (length > polycurve.Length) { return("Select a segment length smaller than the length of the polycurve."); } else { double absLength = DSCore.Math.Abs(length); double ptParam = polycurve.ParameterAtPoint(point); double dist = polycurve.SegmentLengthAtParameter(ptParam); double minusDist = dist - absLength; double maxDist = dist + absLength; if (minusDist < 0) { minusDist = 0; } if (maxDist > polycurve.Length) { maxDist = polycurve.Length; } Autodesk.DesignScript.Geometry.Point minusPt = polycurve.PointAtSegmentLength(minusDist); Autodesk.DesignScript.Geometry.Point maxPt = polycurve.PointAtSegmentLength(maxDist); double number = DSCore.Math.MapTo(0, 1, param, minusDist, maxDist); Autodesk.DesignScript.Geometry.Point newPoint = polycurve.PointAtSegmentLength(number); return(newPoint); } }