(defun C:convert-lwpolyline-to-txt-points ( / 2dpline_vla list-str n pline spisok)
  (load_global_variable)
  (initget 1)(setq pline (car (entsel "\nВыбери полилинию трассы: ")))
  (cond
    ((eq pline nil)
     (alert "Ничего не выбрано!"))
    ((not(eq (cdr(assoc 0 (entget pline))) "LWPOLYLINE"))
     (alert "Выбрана не 2D полилиния!"))
    ((eq (cdr(assoc 0 (entget pline))) "LWPOLYLINE")
     
     (setq 2Dpline_vla (vlax-ename->vla-object pline))
     (setq spisok (extract_coord_lwpolyline (entget pline)))
     (setq n 1)
     (foreach x spisok
       (setq list-str (append list-str (list (strcat (itoa n)","(rtos(nth 1 x)2 3)","(rtos(nth 0 x)2 3)",,"))))
       (setq n (1+ n))
       )
     (setq put-output-file (strcat
			     (getvar "DWGPREFIX")
			     (substr (getvar "DWGNAME") 1 (-(strlen (getvar "DWGNAME"))4))
			     ".txt"
			     ))
     (if (setq put-output-file (getfiled "Имя сохраняемого файла..." put-output-file "txt" 1))
       (file_write_list_to_file put-output-file list-str)
       )
     )
    )
  (princ)
  )