Since the Points will always be in a straight line in XY terms, no matter what their order from the order of the contours' virtual intersections with the straight guide path, it should be possible to sort them by either X or Y coordinate, and apply their coordinates to a new 3DPolyline. The concept [not tested except most of the pieces in isolation, nor assembled into an actual routine yet]:
Add each Point's location to a list as it's created, i.e. add this:
....
(vlax-release-object obj_point)
(setq ptlist (cons (cdr (assoc 10 (entget (entnext)))) ptlist))
);while Inters_list
....
Then after it's done making all the points, you'll have a list of all their locations. I assume [without studying the code deeply] that the order of that list will be affected by the drawing order of the contours, in which case sort them by [arbitrarily] X coordinates:
(setq ptlist (vl-sort ptlist '(lambda (a b) (< (car a) (car b))))
[If the guide line might ever be parallel to the Y axis so the X coordinates of the Points are all the same, a check could be added for that, and if it finds that condition, it could sort by Y coordinates instead.]
Then string all those coordinates together into one undifferentiated list, the way they're stored in a 3DPolyline's VLA properties:
(setq ptscoords (apply 'append ptlist))
Have the routine draw any simple initial 3DPolyline, and make a VLA object of it:
(command "_.3dpoly" '(0 0 0) '(1 0 0) "")
(setq 3dp (vlax-ename->vla-object (entlast)))
and impose that coordinates list on it:
(vlax-put 3dp 'coordinates ptscoords)
Kent Cooper, AIA