Oh ok. I think I get it. The pointsOnPline below will accept two points located on the polyline (or any curve object, actually) and return the distance along the object. If the points are not exactly on the object it will return nil (this can be adjusted so that points are projected onto the object if you wish).
The command function is just for testing it.
(defun pointsOnPline (obj p1 p2 / pd1 pd2)
(vl-load-com)
(if (= (type obj) 'ENAME)
(setq obj (vlax-ename->vla-object obj))
)
(cond ((and (setq pd1 (vlax-curve-getDistAtPoint obj p1))
(setq pd2 (vlax-curve-getDistAtPoint obj p2))
)
(- pd2 pd1)
)
)
)
(defun C:POP (/ ent p1 p2 dist)
(setq ent (car (entsel "\nPick a polyline: ")))
(setq p1 (getpoint "\nFirst point on pline: ")
p2 (getpoint "\nSecond point on pline: ")
)
(and p1
p2
(if (setq dist (pointsOnPline ent p1 p2))
(princ (strcat "\nDistance along pline: " (rtos dist)))
(princ "\nOne or both points was not on pline")
)
)
(princ)
)