Вот текст скрипта, работает как надо
'=========================
'polyline_Set_M.cal
'Author: Ianko Tchoukanski
'
http://www.ian-ko.com'=========================
Dim pPoint As IPoint
Dim pPredPoint As IPoint
Dim pPolyline As IPolyline
Dim pPointColl As IPointCollection
Dim pNewPointColl As IPointCollection
Dim pMA As IMAware
Dim dM As Double
Dim i As Long
'==========================
'adjust the parameters below
dM = 0
'if M value from a field is to be used unremark the following line
'remove the quotation marks and adjust the field name
'dM = "[M_FIELD]"
'==========================
If (Not IsNull([Shape])) Then
Set pPolyline = [Shape]
If (Not pPolyline.IsEmpty) Then
Set pPointColl = pPolyline
Set pNewPointColl = New Polyline
For i = 0 To pPointColl.PointCount - 1
Set pPoint = pPointColl.Point(i)
If i=0 Then
pPoint.M=dM
Else
Set pPredPoint= pPointColl.Point(i-1)
dM = dM + Sqr((pPoint.X-pPredPoint.X)^2+(pPoint.Y-pPredPoint.Y)^2)
pPoint.M = dM
End If
pNewPointColl.AddPoint pPoint
Next i
Set pPolyline = pNewPointColl
Set pMA = pPolyline
pMA.MAware = True
End If
End If
_esri_field_calculator_splitter__
pPolyline