(defun C:draw_interpolate_elevation (/ *error* lwpoly int-point lwpoly p1 p2 p3 z)
  ; вычисление интерполированной отметки
  
  (load_global_variable)
  
  (defun *error* (msg)
    (if (not(eq lwpoly nil))
      (vla-delete lwpoly)
      )
    (princ)
    )
  
  (geo_tools-help "draw_interpolate_elevation")
  (if (setq p1(get-point-draw_interpolate_elevation))
    (if (setq p2(get-point-draw_interpolate_elevation))
      (progn
	(setq lwpoly
	       (draw-lwpolyline-vla-by-list-property
		 (list(cons "spece" (if (eq (getvar "CTAB")"Model")model_spece paper_spece))
		      (cons "Coordinates" (list p1 p2))
		      (cons "Color" 1)
		      (cons "Linetype" "Continuous")
		      )))
	(while (setq p3(getpoint "\nУкажи интерполируемую точку: "))
	  (progn
	    (setq int-point(vlax-curve-getClosestPointTo lwpoly p3))
	    (setq z(-(nth 2 p1)(* (/(-(nth 2 p1)(nth 2 p2))(vla-get-Length lwpoly))(vlax-curve-getDistAtPoint lwpoly int-point))))
	    (draw-mleader-vla-by-list-property
	      (list(cons "spece" (if (eq (getvar "CTAB")"Model")model_spece paper_spece))
		   (cons "LeaderLineCoor" (list int-point (mapcar '+ int-point (list (/ 10.0 (getvar "CANNOSCALEVALUE")) (/ 10.0 (getvar "CANNOSCALEVALUE"))0))))
		   (cons "StyleName" "Подписи")
		   (cons "TextHeight" (/ 2.0 (getvar "CANNOSCALEVALUE")))
		   (cons "TextString" (rtos z 2 3))
		   ))
	    
	    )
	  )
	(if (not(eq lwpoly nil))
	      (vla-delete lwpoly)
	      )
	)
      )
    )
  (princ)
  )

(defun get-point-draw_interpolate_elevation ( / d flag marker obj point temp z result-point)
  (setq flag T)
  (while flag
    (initget "Ввести выХод")
    (setq temp(entsel "\nВыбери точку,текст или мультивыноску с отметкой[Ввести/выХод]<Ввести>: "))
    (if (eq(type temp)'list)
      (setq obj (car temp))
      (setq obj temp))
    (cond
      ((eq obj "выХод")
       (setq z nil)
       (setq flag nil)
       )
      ((or(eq obj nil)(eq obj "Ввести"))
       (setq z (getreal"\nВведи отметку<0.00>: "))
       (if (eq z nil) (setq z 0.0))
       (setq point (getpoint "\nУкажи точку на плане: "))
       (setq result-point (list (nth 0 point)(nth 1 point)z))
       (setq flag nil)
       )
      ((eq (cdr(assoc 0 (entget obj))) "TEXT")
       (setq point (getpoint "\nУкажи точку на плане: "))
       (setq z(atof(edit_text_clean_for_number(cdr(assoc 1(entget obj))))))
       (setq result-point (list (nth 0 point)(nth 1 point)z))
       (setq flag nil)
       )
      ((eq (cdr(assoc 0 (entget obj))) "AECC_COGO_POINT")
       (setq point (vlax-safearray->list(vlax-variant-value(vlax-get-property  (vlax-ename->vla-object obj) "Location"))))
       (setq z(vlax-get-property  (vlax-ename->vla-object obj) "ELEVATION"))
       (setq result-point (list (nth 0 point)(nth 1 point)z))
       (setq flag nil)
       )
      ((eq (cdr(assoc 0 (entget obj))) "MULTILEADER")
       (setq point (get-sel-point-multileader obj))
       (setq z (get-string-multileader obj))
       (setq result-point (list (nth 0 point)(nth 1 point)(car(nth 0 z))))
       (setq flag nil)
       )
      (T
       (alert "Ошибка! Выбран не объект не допустимого типа. Допускаются однострочный текст и точки COGO. Попробуй снова.")
       )
      )
    )
  result-point
  )