(defun C:draw_gost_deflexion_be_plan (/ p1 p2 os t1 t2 up-down dx dy ar_x ar_y text_dx text_dy temp)
  ; отклонения колонны в плане
  (initget)(setq p1 (getpoint "\nУкажи главную ось<Enter - горизонтально>: "))
  (if(eq p1 nil)
    (setq os 0.0)
    (if (setq p2(getpoint p1 " Вторая точка: "))
      (setq os (angle p1 p2))
      ))
  (if (= *radius* nil) (setq *radius* 0.15))
  (if (setq temp (getreal (strcat "\nУкажите радиус колонны<" (rtos *radius* 2 3)">: ")))
    (setq *radius* temp))
  (initget)(setq t1(getpoint "\nУкажи проектное положение оси колонны<enter-выход>: "))
  (setq up-down "Верх")
  (while (not (eq t1 nil))
    (while (not (eq 'list (type t2)))
      (initget 1 "Верх Низ")(setq t2(getpoint (strcat "\nУкажи измеренное положение оси [Верха/Низа]колонны <" up-down ">: ")))
      (if (eq 'STR (type t2))(setq up-down t2 t2 nil))
      )
    (setq dx (*(distance t1 t2) (sin (-(angle t1 t2)os))))
    (setq dy (*(distance t1 t2) (cos (-(angle t1 t2)os))))
    
    (setq text_dx (rtos(*(abs dx)1000)2 0))
    (setq text_dy (rtos(*(abs dy)1000)2 0))
    (cond
      ((not (minusp dx))(setq ar_x (+ os (/ pi 2))));верх
      ((minusp dx) (setq ar_x (+ os (* pi 1.5))));низ
      )
    (cond
      ((minusp dy) (setq ar_y (+ os pi)));лево
      ((not (minusp dy)) (setq ar_y os));право
      )
    (if (> (abs dx) 0.00099)(progn
			(draw-arrow-deflexion t1 ar_x *radius*)
			(draw-text-deflexion t1 ar_x *radius* up-down dx os)))
    (if (> (abs dy) 0.00099)(progn
			(draw-arrow-deflexion t1 ar_y *radius*)
			(draw-text-deflexion t1 ar_y *radius* up-down dy os)))
    (setq t2 nil)
    (initget)(setq t1(getpoint "\nУкажи проектное положение оси колонны<enter-выход>: "))
    )
  (princ)
  )

(defun draw-arrow-deflexion (point angle-a radius / )
  ;вставка стрелочки смещения
  (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(6 . "Continuous") '(100 . "AcDbPolyline")'(90 . 3)
		   (cons 10 point) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0)
		   (cons 10 (polar point angle-a (+ radius(/ 2.5(getvar "CANNOSCALEVALUE"))))) (cons 40 (/ 1.0 (getvar "CANNOSCALEVALUE")))'(41 . 0.0)  '(42 . 0.0)
		   (cons 10 (polar point angle-a (+ radius(/ 5.0(getvar "CANNOSCALEVALUE"))))) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0)
		   ))
  )

(defun draw-text-deflexion (point angle-t radius up-down delta os / insert-point p1 p2 p3 p4 text-ling)
  ; вставка подписи смещения
  (setq text-ling (calculation_str_long_be_h_stile(rtos(*(abs delta)1000)2 0) (/ 2.5(getvar "CANNOSCALEVALUE")) (getvar "TEXTSTYLE")))
  (setq insert-point (polar
		       (polar point angle-t
			      (if (minusp delta)
				(+(+ radius(/ 5.0(getvar "CANNOSCALEVALUE")))text-ling)
				(+ radius(/ 1.0(getvar "CANNOSCALEVALUE")))
				)
			      )
		       (if (minusp delta)
			 (- angle-t (/ pi 2))
			 (+ angle-t (/ pi 2)))
		       (if (= up-down"Верх")
			 (/ 2.5(getvar "CANNOSCALEVALUE"))
			 (/ -2.5(getvar "CANNOSCALEVALUE")))
		       ))
  (setq p1 (polar insert-point(if(minusp delta)(- angle-t(/ pi 2))(+ angle-t(/ pi 2)))(/ 1.5(getvar "CANNOSCALEVALUE"))))
  (setq p2 (polar p1 (if(minusp delta)(- angle-t pi) angle-t) (/ 3(getvar "CANNOSCALEVALUE"))))
  (setq p3 (polar p2(if(minusp delta)(+ angle-t(/ pi 2))(- angle-t(/ pi 2)))(/ 3(getvar "CANNOSCALEVALUE"))))
  (setq p4 (polar p3 (if(minusp delta)angle-t(- angle-t pi))(/ 3(getvar "CANNOSCALEVALUE"))))
  (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(6 . "Continuous") '(100 . "AcDbPolyline")'(90 . 3)'(70 . 1)
		 (cons 10 p1)(cons 10 p2)(cons 10 p3)(cons 10 p4)
		 ))
  (entmake (list '(0 . "TEXT")
		 (cons 10 insert-point)
		 (cons 40 (/ 2.5(getvar "CANNOSCALEVALUE")))
		 (cons 1 (if (= up-down"Верх")"В" "Н"))
		 (cons 50 (if(minusp delta)(- angle-t pi) angle-t))
		 (cons 11 (polar insert-point (if(minusp delta)(- angle-t pi) angle-t) (/ 1.5(getvar "CANNOSCALEVALUE"))))
		 '(72 . 4)))
  (entmake (list '(0 . "TEXT")
		 (cons 10 insert-point)
		 (cons 40 (/ 2.5(getvar "CANNOSCALEVALUE")))
		 (cons 1 (rtos(*(abs delta)1000)2 0))
		 (cons 50 (if(minusp delta)(- angle-t pi) angle-t))
		 (cons 11 (polar insert-point (if(minusp delta)(- angle-t pi) angle-t) (/ 4(getvar "CANNOSCALEVALUE"))))
		 '(73 . 2)))
)
