(defun C:export_punkts_in_file (/ list-punct-strings n o-doc put-file squares z-only)
  ;экспортирует весь каталог в текстовый файл
  (if (setq o-doc(XML-Get-XMLObject (get-patch-to-katalog)))
    (if(setq put-file (getfiled "Имя сохраняемого файла..." (getvar "DWGPREFIX") "txt" 1))
      (progn
	(setq squares(XML-Get-Child (XML-Get-Child o-doc nil "puncts") nil "squares"))
	(setq z-only(XML-Get-Child (XML-Get-Child o-doc nil "puncts") nil "z-only"))
	(setq n 1)
	(foreach x (XML-Get-ChildList squares)
	  (foreach y (XML-Get-ChildList x)
	    (setq list-punct-strings (append list-punct-strings (list (convert-punkt-recorg-to-string y))))
	    (if (=(rem n 1000)0)(grtext -1 (strcat(itoa n))))
	    (setq n (1+ n))
	    )
;;;	  (gc)
	  )
	(foreach z (XML-Get-ChildList z-only)
	    (setq list-punct-strings (append list-punct-strings (list (convert-punkt-recorg-to-string z))))
	    (if (=(rem n 1000)0)(grtext -1 (strcat(itoa n))))
	    (setq n (1+ n))
	    )
	(grtext -1 "запись...")
	(file_write_list_to_file put-file list-punct-strings)
	(grtext -1 "")
	(princ (strcat "\nЭкспортировано " (itoa(length list-punct-strings)) " пунктов."))
	(if squares(vlax-release-object squares))
	(if z-only(vlax-release-object z-only))
	(if o-doc(vlax-release-object o-doc))
	)
      )
    (alert "Файл каталога координат пунктов не обнаружен!")
    )
  (princ)
  )