vlax-curve-getClosestPointTo will work while the current view plane is parallel to the selected object plane.
osnap and vlax-curve-getClosestPointToProjection would work whatever the view direction, but...
... we noticed some strange behaviors with polylines (according to the polyline type).
(setq ent (entsel))
These two expressions would return the WCS coordinates of the picked point on the polyline:
(trans (osnap (cadr ent) "_nea") 1 0)
(vlax-curve-getClosestPointToProjection
(car ent)
(trans (cadr ent) 1 0)
(mapcar '-
(trans (getvar "VIEWDIR") 1 0)
(trans '(0 0 0) 1 0)
)
)
But, the first one may return wrong results with 'old style' 2d polylines and the second one wrong results with 3d polylines.
Both work with lwpolylines.