Since some of the Polyline's segments are arcs, and since adding vertices within them requires calculations of bulge factors for the resulting arc segments on both sides, and since adding them with PEDIT/Edit vertex/Insert option give unwanted results, etc., it seems easier to just Break it with no gap at the locations at all those distances along it, and Join the resulting two pieces after each Break. AFTER saving the file to .CSV format for reading:
(defun C:APVC ; = Add Polyline Vertices from CSV file
(/ csv lin dists pts)
(setvar 'ltgapselection 1)
(setq
poly (car (entsel "\nPolyline to add vertices to: "))
csv (open "C:/Your/File/Path/test_poly.csv" "r") ;; <-- EDIT FILE PATH
); setq
(while (setq lin (read-line csv))
(if (wcmatch lin "#*"); starts with a number [it's a "data" line]
(setq dists (cons (atof (substr lin (+ (vl-string-position 44 lin 1 T) 2))) dists))
); if
); while
(setq pts (mapcar '(lambda (x) (vlax-curve-getPointAtDist poly (* x 1000))) dists))
(close csv)
(foreach pt pts
(command
"_.zoom" "_c" pt 100 ;;; [spelling out "_cen" or "_center" is taken as Osnap call]
"_.break" "_non" pt "@"
"_.pedit" "_multiple" poly "_last" "" "_join" 0.0 ""
)
); foreach
(command "_.zoom" "_object" poly "")
(prin1)
)
Note the need to specify the file path for the file.
It counts on the file being in the form of your example, with all the lines [and only those lines] that contain relevant information all starting with a number, and with the distance part of each line being at the end, following the last comma delimiter.
It can use the usual enhancements, verification that you picked the right kind of thing, a check on whether the Polyline is longer than the greatest distance value, Undo Begin/End wrapping, etc., but see whether it does what you want.
Kent Cooper, AIA