(defun C:profile_dimension (/ accuracy accuracy-downgrade block-profile-obj curent-profile flag flag1 h horizontal-scale i profile-mode reference-level s d sel-uklon t1 t2 vertical-scale old-profile-item-list)
  ; вычисляет превышение расстояние и уклон между двумя указаными точками на профиле
  (setq profile-mode (vlax-ldata-get "geo_tools_dictionary" "profile-mode"))
  (if(if(not profile-mode)(profile-seleckt-curent-mode)T)
    (progn
      (if(= profile-mode 1)
	(progn
	  (setq curent-profile(vlax-ldata-get "geo_tools_dictionary" "curent-profile"))
	  (setq flag (profile-check-curent-profile curent-profile))
	  (if flag
	    (progn
	      (princ(strcat"\nТекущий профиль: "(car curent-profile)))
	      (setq block-profile-obj (cdr curent-profile))
	      (setq vertical-scale (vlax-ldata-get block-profile-obj"vertical-scale"))
	      (setq horizontal-scale (vlax-ldata-get block-profile-obj"horizontal-scale"))
	      (setq profile-string-list (vlax-ldata-get block-profile-obj"profile-string-list"))
	      (if profile-string-list
		(progn
		  (setq n 0)
		  (setq n-max (length profile-string-list))
		  (while (not flag1)
		    (setq item (nth n profile-string-list))
		    (if (=(nth 1 item) "dist-downgrade")
		      (progn
			(setq sel-uklon (if (eq (nth 3 item)"0") 1000.0 1.0))
			(setq accuracy-downgrade(atoi(nth 5 item)))
			(setq accuracy (atoi(nth 4 item)))
			(setq flag1 T)
			)
		      )
		    (setq n (1+ n))
		    (if (= n-max n)(setq flag1 T))
		    )
		  (if (and (not sel-uklon)(not accuracy-downgrade)(not accuracy))
		    (progn
		  (princ "\nНе найдены данные для вычисления уклонов в профиле! Использую из старого профиля")
		  (setq old-profile-item-list(profile-get-old-item-list))
		  (setq sel-uklon (if (=(cadr(assoc "sel-uklon" old-profile-item-list))0) 1000.0 1.0))
		  (setq accuracy-downgrade (cadr(assoc "accuracy-downgrade" old-profile-item-list)))
		  (setq accuracy (cadr(assoc "accuracy" old-profile-item-list)))
		      )
		    )
		  )
		(princ profile-string-list)
		)
	      )
		(progn
		  (princ "\nНе найдены данные для вычисления уклонов в профиле! Использую из старого профиля")
		  (setq old-profile-item-list(profile-get-old-item-list))
		  (setq sel-uklon (if (=(cadr(assoc "sel-uklon" old-profile-item-list))0) 1000.0 1.0))
		  (setq accuracy-downgrade (cadr(assoc "accuracy-downgrade" old-profile-item-list)))
		  (setq accuracy (cadr(assoc "accuracy" old-profile-item-list)))
		  )
		)
	      )
	(progn
	  (setq horizontal-scale (cadr(assoc "horizontal-scale" (vlax-ldata-get "geo_tools_dictionary" "old-profile-item-list"))))
	  (setq vertical-scale (cadr(assoc "vertical-scale" (vlax-ldata-get "geo_tools_dictionary" "old-profile-item-list"))))
	  (setq reference-level (cadr(assoc "reference-level" (vlax-ldata-get "geo_tools_dictionary" "old-profile-item-list"))))
	  (setq sel-uklon (if (=(cadr(assoc "sel-uklon" (vlax-ldata-get "geo_tools_dictionary" "old-profile-item-list")))0) 1000.0 1.0))
	  (setq accuracy-downgrade (cadr(assoc "accuracy-downgrade" (vlax-ldata-get "geo_tools_dictionary" "old-profile-item-list"))))
	  (setq accuracy (cadr(assoc "accuracy" (vlax-ldata-get "geo_tools_dictionary" "old-profile-item-list"))))
	  (princ(strcat
		  "\nМасштабВ 1:" (itoa horizontal-scale)
		  " МасштабГ 1:" (itoa vertical-scale)
		  " Отметка условного горизонта: " (rtos reference-level 2 2) "м"
		  ))
	  (setq flag T))
	)
      (if
	flag
	(progn
	  (setq flag nil)
	  (while(not flag)
	    (initget)(setq t1(getpoint "\nУкажи точку #1 на профоле: "))
	    (redraw)
	    (if t1
	      (progn
		(draw_temp_X t1 1)
		(initget)(setq t2(getpoint t1 "\nУкажи точку #2 на профоле: "))
		(draw_temp_X t2 1)
		(setq h (* (-(nth 1 t2)(nth 1 t1)) (/ (* vertical-scale (/ 1000.0 horizontal-scale)) 1000.0)))
		(setq s (abs(- (nth 0 t1) (nth 0 t2))))
		(setq d (sqrt (+(expt h 2)(expt s 2))))
		(if (= s 0.0)
		  (setq i "вертикаль!")
		  (setq i (rtos(* (/ h s) sel-uklon)2 accuracy-downgrade))
		  )
		(princ "\nh-превышение; s-горизонтальное проложение; d-наклонное расстояние; i-уклон")
		(princ (strcat "\nh=" (rtos h 2 accuracy) "м; s="(rtos s 2 accuracy)"м; d="(rtos d 2 accuracy)"м; (d-s)=" (rtos (- d s) 2 accuracy) "м; i="i))
		)
	      (setq flag T)
	      )
	    )
	  )
	)
      )
    )
  (princ)
  )

;;;(setq sel-uklon (if (eq (cadr(assoc "sel-uklon" (vlax-ldata-get "geo_tools_dictionary" "old-profile-item-list")))0) 1000.0 1.0))
;;;(setq accuracy-downgrade(cadr(assoc "accuracy-downgrade" (vlax-ldata-get "geo_tools_dictionary" "old-profile-item-list"))))
;;;(setq i(rtos (abs(*(/ (* (- (nth 1 p1) (nth 1 p2))(/ (* mv (/ 1000.0 mg)) 1000.0)) (- (nth 0 p1) (nth 0 p2))) sel-uklon)) 2 accuracy-downgrade))