;; poly_from_csv.lsp
(defun C:GO ( / CSV_name ifil Field x i c px py px_lst py_lst p_lst p1 p2 )
(command "_limits" "off")
;; Browse box to pick the .csv file
(setq CSV_name "")
(setq CSV_name (getfiled "Select Point List .csv file" "" "csv" 2))
;; Read-in the values to X & Y lists
(setq ifil (open CSV_name "r")); open the file
(while (setq rd-line (read-line ifil))
(setq x (strlen rd-line))
(setq i 1 Field 1 Px "" Py "")
(repeat x
(setq c (substr rd-line i 1)); read a character
(if (or (= c ",")(= c " "))
(progn
(setq Field (+ Field 1))
(setq c "")
); end progn
); end if
(if (and (/= c "")(= Field 1))
(setq Px (strcat Px c)); stack first point
); end if
(if (and (/= c "")(= Field 2))
(setq Py (strcat Py c)); stack second point
); end if
(setq i (+ i 1))
); end repeat
(if Px
(progn
(setq Px_lst (cons Px Px_lst))
(setq Py_lst (cons Py Py_lst))
); progn
); if
); while
(close ifil)
;; Draw the Polyline
(if (and (> (length Px_lst) 1)(> (length Py_lst) 1))
(progn
(setq Px_lst (reverse Px_lst))
(setq Py_lst (reverse Py_lst))
(setq C 0)
(repeat (length Px_lst)
(setq Px (atof (nth C Px_lst)))
(setq Py (atof (nth C Py_lst)))
(setq P_lst (cons (list Px Py 0.0) P_lst))
(setq C (+ C 1))
); repeat
(setq P_lst (reverse P_lst))
(setq P1 (nth 0 P_lst)); start point
(setvar "lastpoint" P1)
(setq P_lst (cdr P_lst)); strip 1st point
(setq C 1)
(repeat (length P_lst)
(setq P1 (getvar "lastpoint"))
(setq P2 (nth C P_lst))
(if (and (/= P1 nil)(/= P2 nil))
(command "_pline" P1 "_W" "0.50" "0.50" P2 ""); width as desired
); if
(setq C (+ C 1))
); repeat
); end progn
); end if
;; Exit
(princ)
); function GO
(princ); silent load
Bob
GENIUS! BRILLIANT!!!!! This is going to save a TON of time, as there are many times I've wanted to join points with consecutive point numbers. I found that this method works equally well when you add elevation to the mix. I was able to use the line command through hundreds of points, then join them to a 3-D polyline, then convert to a featureline to use in generating surfaces. I realize this was years ago, but Thank you for taking the time to share this!
Hey, you can use too an excel with this format and use CONCATENATE function to assign x and y coordinates, you copy the column lines with "pl" in the first, and copy directly in command promt in autocad.