(defun dialog-draw-ramka-planshet ( / dcl_id list-dialog mode temp patch-blank patch-current current-version)
  ; диалог настроек зарамочного планшетов
  (setq patch-blank(strcat *geo_tools_user_dat_dir* "\\template\\blank.plt"))
  (setq current-version 1.0)
  (setq patch-current(vlax-ldata-get "geo_tools_dictionary" "data-draw-ramka-planshet"))
  
  (if (or (not(file-p patch-current))(not patch-current))
    (setq patch-current patch-blank))
  (setq list-dialog(get-data-draw-ramka-planshet patch-current))
  (if (get-item-by-name-in-list list-dialog "version")
    (if (> (atoi(get-item-by-name-in-list list-dialog "version"))current-version)
      (progn
	(alert "Ошибка. Файл создан более новой версии.\nОбновите Geo_Tools до последней версии.")
	(setq patch-current patch-blank)
	(setq list-dialog(get-data-draw-ramka-planshet patch-current))
	)
      )
    (progn
      (alert "Ошибка. Файл не содержит данные о версии.")
      (setq patch-current patch-blank)
      (setq list-dialog(get-data-draw-ramka-planshet patch-current))
      )
    )
  (setq dcl_id (geo-tools-load-dialog "dialog_draw_ramka_planshet"))
  (new_dialog "dialog_draw_ramka_planshet" dcl_id)
  
  (set_tile-dialog-draw-ramka-planshet list-dialog patch-current)
  
  (action_tile "find"
    (vl-prin1-to-string
      '(progn
	(setq temp (getfiled "Выбор файла каталога" (getvar "DWGPREFIX")  "dwg" 0))
	(if temp
	 (progn
	  (set_tile "path" temp)
	  )
	 )
	)))
  
  (action_tile "analisis-nomenclature"
    (vl-prin1-to-string
      '(progn
	(mode_tile-dialog-draw-ramka-planshet (atoi $value))
	)))

  (action_tile "new"
    (vl-prin1-to-string
      '(progn
	(setq patch-current patch-blank)
	(setq list-dialog(get-data-draw-ramka-planshet patch-current))
	(set_tile-dialog-draw-ramka-planshet list-dialog patch-current)
	)))
  
  (action_tile "open"
    (vl-prin1-to-string
      '(progn
	(setq temp(getfiled "Выбор файла" (getvar "DWGPREFIX") "plt" 0))
	(if temp
	 (progn
	  (setq patch-current temp)
	  (setq list-dialog(get-data-draw-ramka-planshet patch-current))
	  (if (get-item-by-name-in-list list-dialog "version")
	   (if (> (atoi(get-item-by-name-in-list list-dialog "version"))current-version)
	    (progn
	     (alert "Ошибка. Файл создан более новой версии.\nОбновите Geo_Tools до последней версии.")
	     (setq patch-current patch-blank)
	     (setq list-dialog(get-data-draw-ramka-planshet patch-current))
	     )
	    )
	   (progn
	    (alert "Ошибка. Файл не содержит данные о версии.")
	    (setq patch-current patch-blank)
	    (setq list-dialog(get-data-draw-ramka-planshet patch-current))
	    )
	   )
	  (set_tile-dialog-draw-ramka-planshet list-dialog patch-current)
	  )
	 )
	)))
  
  (action_tile "save"
    (vl-prin1-to-string
      '(progn
	(if (/= patch-current patch-blank)
	 (progn
	  (setq list-dialog(get_tile-dialog-draw-ramka-planshet list-dialog))
	  (put-data-draw-ramka-planshet patch-current list-dialog)
	  )
	 (progn (setq temp(getfiled "Сохранить как..." (strcat(getvar "DWGPREFIX")
							(substr (getvar "DWGNAME") 1 (-(strlen (getvar "DWGNAME"))4))) "plt" 1))
	  (if temp
	   (progn
	    (setq patch-current temp)
	    (princ(setq list-dialog(get_tile-dialog-draw-ramka-planshet list-dialog)))
	    (put-data-draw-ramka-planshet patch-current list-dialog)
	    (set_tile-dialog-draw-ramka-planshet list-dialog patch-current)))))
	)))
  
  (action_tile "save_as"
    (vl-prin1-to-string
      '(progn
	(setq temp(getfiled "Сохранить как..." (strcat(getvar "DWGPREFIX")
						(substr (getvar "DWGNAME") 1 (-(strlen (getvar "DWGNAME"))4))) "plt" 1))
	(if temp
	 (progn
	  (setq patch-current temp)
	  (setq list-dialog(get_tile-dialog-draw-ramka-planshet list-dialog))
	  (put-data-draw-ramka-planshet patch-current list-dialog)
	  (set_tile-dialog-draw-ramka-planshet list-dialog patch-current)))
	)))

  (action_tile "accept"
    (vl-prin1-to-string
      '(progn
	(setq list-dialog(get_tile-dialog-draw-ramka-planshet list-dialog))
	(done_dialog 1)
	)))
  
  (if (eq (start_dialog) 0)
    (setq list-dialog nil)
    (progn
      (if (/= patch-current patch-blank)
	(progn
	  (put-data-draw-ramka-planshet patch-current list-dialog)
	  )
	(progn
	  (setq temp(getfiled "Сохранить как..."
			      (strcat(getvar "DWGPREFIX")
				     (substr (getvar "DWGNAME") 1 (-(strlen (getvar "DWGNAME"))4)))
			      "plt" 1))
	  (if temp
	    (progn
	      (setq patch-current temp)
	      (put-data-draw-ramka-planshet patch-current list-dialog)
	      (set_tile-dialog-draw-ramka-planshet list-dialog patch-current)))))
      )
    )
  (unload_dialog dcl_id)
  list-dialog
  )