Hi csgoh,
The problem is not so much with Stig's routine, but with the point passed to it.....(entsel) always has a Z value equal to the current Elevation, so the end point of the 3d poly happened to be the "closestpointto" the selected point. Adding a (osnap pt near) solves this:
......
((= obj_typ "AcDb3dPolyline")
(if (setq pt_lst (getSegment obj (osnap (last ent) "near") ucs-number)
.....
Command: test
Select a 3dpolyline
"eParam " 3.0
"Param cpt " 1.46137
"pt_lst " ((26.2639 24.409 20.0) (35.6916 24.9199 30.0))
"ang " 0.0541372
HTH,
Jeff