(defun C:polyline_and_text_to_txt ( / 2dpline_vla list-str n name_layout number-obj pline putch-text-file-coord spisok)
  (if (not *number-list-point*) (setq *number-list-point* 1))
  (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")
     (initget 1)(setq number-obj (car (entsel "\nВыбери номер: ")))
     (setq name_layout (vl-string-trim ":"(cdr (assoc 1 (entget number-obj)))))
     (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 *number-list-point*)","(rtos(nth 1 x)2 3)","(rtos(nth 0 x)2 3)",0.0,"(itoa n)"-"name_layout))))
       (setq n (1+ n))
       (setq *number-list-point* (1+ *number-list-point*))
       )
     (setq putch-text-file-coord (strcat
				   (getvar "DWGPREFIX")
				   (substr (getvar "DWGNAME") 1 (-(strlen (getvar "DWGNAME"))4))"-"name_layout
				   ".txt"
				   ))
;;;     (alert (strcat"Сейчас будет сформирован файл координат:\n" putch-text-file-coord))
     (file_write_list_to_file putch-text-file-coord list-str)
;;;     (alert "Файл с координатами сформирован!")
     )
    )
  (princ)
  )