(defun C:draw_slope (/ obj1 obj2 d line_odj line_vla_odj temp list_line_obj point11_list point10_list dist_point10_list dist_point11_list item
		bad_dist_list min_bad_dist max_bad_dist dist_item n shag min_position_obj max_position_obj bad_dist_position_list)
  ; откосы
  (geo_tools-help "draw_slope")
  
  (defun min_dist_point (p list_mas / point_list dist_list n); вычисляет ближайшую к указаной точке из списка безопасного массива
    (repeat (/(length list_mas)3)
      (setq point_list (append point_list (list(list (car list_mas)(cadr list_mas)(caddr list_mas)))))
      (setq list_mas (cdddr list_mas))
      )
    (setq n 0)
    (repeat (length point_list)
      (setq dist_list (append dist_list (list (distance p (nth n point_list)))))
      (setq n (1+ n))
      )
    (nth (vl-position (apply 'min dist_list) dist_list) point_list)
    )

  (defun correct_intersekt_slope ( / min_bad_dist max_bad_dist n dist_item item shag line_odj min_position_obj max_position_obj bad_dist_position_list)
    (setq min_bad_dist (apply 'min bad_dist_list))
    (setq max_bad_dist (apply 'max bad_dist_list))
    (setq n 0)
    (setq bad_dist_list nil)
    (repeat (length dist_point11_list)
      (setq item(nth n dist_point11_list))
      (if (and (or(< min_bad_dist item)(= min_bad_dist item))
	       (or(> max_bad_dist item)(= max_bad_dist item)))
	(setq bad_dist_list (append bad_dist_list (list item))))
      (setq n (1+ n)))
    (mapcar '(lambda (x) (setq bad_dist_position_list (append bad_dist_position_list (list (vl-position x dist_point11_list)))))
	    bad_dist_list)
    (setq min_position_obj (apply 'min bad_dist_position_list))
    (setq max_position_obj (apply 'max bad_dist_position_list))
    (setq min_bad_dist (vlax-curve-getDistAtPoint obj2 (cdr(assoc 11 (entget (nth min_position_obj list_line_obj))))))
    (setq max_bad_dist (vlax-curve-getDistAtPoint obj2 (cdr(assoc 11 (entget (nth max_position_obj list_line_obj))))))
    (setq shag (/ (- max_bad_dist min_bad_dist)(- max_position_obj min_position_obj)))
    (setq n min_position_obj)
    (setq dist_item (vlax-curve-getDistAtPoint obj2 (cdr(assoc 11 (entget (nth min_position_obj list_line_obj))))))
    (repeat (- max_position_obj min_position_obj)
      (setq line_odj (nth n list_line_obj))
      (entmod(subst (cons 11 (vlax-curve-getPointAtDist obj2 dist_item))
		    (assoc 11 (entget line_odj))(entget line_odj)))
      (entupd line_odj)
      (setq n (1+ n))
      (setq dist_item (+ dist_item shag)))
    (setq bad_dist_list nil)
    )
  
  (initget "Да Нет")(setq ukrep (getstring T "\nОткос укрепленый?[Да/Нет] <Нет>: "))
  (if (eq ukrep nil)(setq ukrep "Нет"))
  (if (eq ukrep "Д")(setq ukrep "Да"))
  (initget 1)(setq obj1(vlax-ename->vla-object (car (entsel"\nВыбери бровку: "))))
  (initget 1)(setq obj2(vlax-ename->vla-object (car (entsel"\nВыбери подошву: "))))
  (setq d (/ 1 (getvar "CANNOSCALEVALUE")))
  (command "_.UNDO" "_begin")
  (while (< d (vlax-curve-getDistAtPoint obj1 (vlax-curve-getEndPoint obj1)))
    (entmake (list '(0 . "LINE") (cons 10 (vlax-curve-getPointAtDist obj1 d))
		   (cons 11 (polar (vlax-curve-getPointAtDist obj1 d)
				   (-(angle '(0 0 0) (vlax-curve-getfirstDeriv obj1 (vlax-curve-getParamAtPoint obj1 (vlax-curve-getPointAtDist obj1 d))))(/ pi 2))
				   (/ 2 (getvar "CANNOSCALEVALUE"))))
		   ))
    (setq line_odj (entlast))
    (setq line_vla_odj (vlax-ename->vla-object line_odj))
    (setq temp (vla-IntersectWith line_vla_odj obj2 acExtendBoth))
    (if (/= -1 (vlax-safearray-get-u-bound(vlax-variant-value temp)1))
      (progn
	(setq temp(vlax-safearray->list(vlax-variant-value temp)))
	(entmod(subst (cons 11 (min_dist_point (vlax-curve-getPointAtDist obj1 d) temp))
		      (assoc 11 (entget line_odj))(entget line_odj)))
	(entupd line_odj)
	(setq list_line_obj (append list_line_obj (list line_odj)))
	(setq point11_list(append point11_list(list(cdr(assoc 11(entget line_odj))))))
	(setq dist_point11_list(append dist_point11_list(list(vlax-curve-getDistAtPoint obj2 (cdr(assoc 11(entget line_odj)))))))
	))
    (setq d (+ d (/ 1 (getvar "CANNOSCALEVALUE"))))
    )
  
  (setq n 0)
  (while (< n (1-(length dist_point11_list)))
    (cond
      ((> (nth n dist_point11_list)(nth (1+ n) dist_point11_list))
       (if (not(or (eq (nth n dist_point11_list) nil)(eq (nth (1+ n) dist_point11_list) nil)))
	 (setq bad_dist_list (append bad_dist_list (list (nth (1+ n) dist_point11_list))))))
      (T
       (if (/= bad_dist_list nil)
	 (progn
	   (if (>(length bad_dist_list)1)
	   (correct_intersekt_slope))
	   (setq bad_dist_list nil)
	   )))
      )
    (setq n (1+ n)))
  (princ ukrep)
  (mapcar '(lambda (x) (if (= (rem (vl-position x list_line_obj)2) 0); короткий штрих или длинный, все четные короткие
			 (progn
			   (entmod(subst (cons 11 (polar (cdr(assoc 10(entget x)))
							 (angle(cdr(assoc 10(entget x)))(cdr(assoc 11(entget x))))
							 (if (< (distance(cdr(assoc 10(entget x)))(cdr(assoc 11(entget x))))(/ 4 (getvar "CANNOSCALEVALUE")))
							   (*(distance(cdr(assoc 10(entget x)))(cdr(assoc 11(entget x))))0.5)
							   (if (> (distance(cdr(assoc 10(entget x)))(cdr(assoc 11(entget x))))(/ 30 (getvar "CANNOSCALEVALUE")))
							     (/(-(distance(cdr(assoc 10(entget x)))(cdr(assoc 11(entget x))))(/ 1 (getvar "CANNOSCALEVALUE")))3.0)
							     (/ 2 (getvar "CANNOSCALEVALUE")))
							  )))
					 (assoc 11 (entget x))(entget x)))
			   (entupd x)
			   (if (eq ukrep "Да"); Добавить точку при укрепленном откосе
			   (entmake (list '(0 . "CIRCLE")
					  (cons 10 (polar (cdr(assoc 10(entget x)))(angle(cdr(assoc 10(entget x)))(cdr(assoc 11(entget x))))
							  (if (< (distance(cdr(assoc 10(entget x)))(cdr(assoc 11(entget x))))(/ 2.5 (getvar "CANNOSCALEVALUE")))
							    (*(distance(cdr(assoc 10(entget x)))(cdr(assoc 11(entget x))))1.3)
							    (+ (distance(cdr(assoc 10(entget x)))(cdr(assoc 11(entget x))))(/ 1 (getvar "CANNOSCALEVALUE")))
							    )
							  ))
					  '(40 . 0.05))))
			   )
			 (progn
			   (entmod(subst (cons 11 (polar (cdr(assoc 10(entget x)))
							 (angle(cdr(assoc 10(entget x)))(cdr(assoc 11(entget x))))
							 (if (< (distance(cdr(assoc 10(entget x)))(cdr(assoc 11(entget x))))(/ 2.5 (getvar "CANNOSCALEVALUE")))
							   (*(distance(cdr(assoc 10(entget x)))(cdr(assoc 11(entget x))))0.85)
							   (-(distance(cdr(assoc 10(entget x)))(cdr(assoc 11(entget x))))(/ 1 (getvar "CANNOSCALEVALUE")))
							   )))
					 (assoc 11 (entget x))(entget x)))
			   (entupd x)
			   )
			 )
	     )
	  list_line_obj)
  (command "_.UNDO" "_end")
  (princ)
  )