From MaxScript Help:

**refineSegment <spline_index_integer> <seg_index_integer> <seg_interp_param_float>**

"Adds a new knot to the indexed segment of the indexed curve at a place along the indexed segment corresponding to the given segment interpolation parameter.

This value is a float in the range of 0.0 to 1.0 specifying a proportion along the segment.

The new knot coordinates, and in-vector and out-vector are automatically computed to maintain the segment’s existing curvature.

This is the primitive used by the refine() function in the Edit Spline modifier.

You can use the MAXScript spline path interpolation functions to derive segment parameters given that a curve’s path interpolation parameter is divided evenly among the segments in a curve.

Given a path interpolation parameter **u** in a spline of m segments, the target segment is:

**n = (m*u) as integer + 1**

The segment parameter is:

**f = (u-(n-1)/m) * m**

This can be refactored to the following which will reduce roundoff error in the calculation:

**f = u*m-n+1**

The refineSegment() function returns the index of the newly inserted knot. "

The only additional thing you should need is to convert from lengthParam to pathParam.