(defun C:profile_draw_dimension (/ accuracy accuracy-downgrade block-profile-obj curent-profile
				 dist downgrade flag flag1 horizontal-scale item n n-max pos
				 profile-mode profile-string-list reference-level sel-uklon string
				 t1 t2 vertical-scale old-profile-item-list)
  ; Ставит маркер на указанном превышении от указаной точки
  (defun draw-line-and-marker (t1 t2 / )
    (vla-StartUndoMark active_document)
    (entmake (list '(0 . "LINE") '(6 . "Continuous") (append '(10) t1) (append '(11) t2)))
    (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(6 . "Continuous") '(100 . "AcDbPolyline")
		   '(90 . 3) '(70 . 1) (cons 43 0)
		   (cons 10 (mapcar '+ t2 (list -1.25 -2.165)))
		   (cons 10 t2)
		   (cons 10 (mapcar '+ t2 (list 1.25 -2.165)))
		   )
	     )
    (vla-EndUndoMark active_document)
    )
  (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 accuracy) "м"
		  ))
	  (setq flag T))
	)
      (if
	flag
	(progn
	  (setq flag nil)
	  (initget)(setq t1(getpoint "\nУкажи начальную точку: "))
	  (while (not(= t1 nil))
	    (initget)(setq string (getstring "\nВведи превышение или уклон и расстояние через запятую: "))
	    (if (/= string "")
	      (if (wcmatch string "*`,*")
		(progn
		  (setq pos (vl-string-position  (ascii ",")string))
		  (setq downgrade(/(atof(substr string 1 pos))sel-uklon))
		  (setq dist(atof(substr string (+ 2 pos))))
		  (setq h (* dist downgrade))
		  (setq t2 (mapcar '+ t1 (list dist (/ h (/ (* vertical-scale (/ 1000.0 horizontal-scale)) 1000.0)))))
		  (draw-line-and-marker t1 t2)
		  )
		(progn
		  (setq t2 (mapcar '+ t1 (list 0 (/ (atof string)(/ (* vertical-scale (/ 1000.0 horizontal-scale)) 1000.0)))))
		  (draw-line-and-marker t1 t2)
		  )
		)
	      )
	    (initget)(setq t1(getpoint "\nУкажи начальную точку: "))
	    )
	  )
	)
      )
    )
  (princ)
  )