(defun draw_profil_insert_block_podval (q_sel_v_pr t1! mg mv min_z max_z usl_z 2Dpline / mid_z t0 pr_name ht styl spisokv dist n p1 p2 x)
  (cond
    ((= q_sel_v_pr 0)(setq pr_name "Подвал В канале"))
    ((= q_sel_v_pr 1)(setq pr_name "Подвал ППУ"))
    ((= q_sel_v_pr 2)(setq pr_name "Подвал Водопровод"))
    ((= q_sel_v_pr 3)(setq pr_name "Подвал Канализация"))
    ((= q_sel_v_pr 4)(setq pr_name "Подвал Газопровод"))
    ((= q_sel_v_pr 5)(setq pr_name "Подвал В канале с дренажом"))
    )
  (if
    (not (tblobjname "block" pr_name))
    (progn
      (command "_insert" pr_name "0,0,0" "1" "1" "0")
      (entdel (entlast))
      )
    )
  (entmake (list '(0 . "INSERT")
		 (cons 2 pr_name)
		 (append '(10) t1!)
		 (cons 41 (/ 1 (/ 1000 mg)))
		 (cons 42 (/ 1 (/ 1000 mg)))
		 (cons 43 (/ 1 (/ 1000 mg)))
		 (cons 50 0)))
  (if
    (not (= q_sel_v_pr 4))
    (progn
      (setq t0 (mapcar '- t1! (list (/ 20 (/ 1000 mg)) 0 )))
      (if
	(not (tblobjname "block" "линейка"))
	(progn
	  (command "_insert" "линейка" "0,0,0" "1" "1" "0")
	  (entdel (entlast))
	  )
	)
      (repeat
	(fix(/(- (+ 3 max_z) usl_z)2))
	(entmake (list '(0 . "INSERT")
		       (cons 2 "линейка")
		       (append '(10) t0)
		       (cons 41 (/ 1 (/ 1000 mg)))
		       (cons 42 (/ 1 (/ (* mv (/ 1000 mg)) 1000)))
		       (cons 43 (/ 1 (/ 1000 mg)))
		       (cons 50 0)))
	(setq t0 (mapcar '+ t0 (list 0 (/ 2 (/ (* mv (/ 1000 mg)) 1000)))))
	)
      (setq mid_z (+(fix (/ (- max_z min_z)2))(fix min_z)))
      (setq ht (/ 3.5 (/ 1000 mg)))
      (setq styl (getvar "TEXTSTYLE"))
      (entmake (list '(0 . "LINE") '(6 . "Continuous")
		     (cons 10 (mapcar '+ t1! (list (/ -20 (/ 1000 mg)) (/ (- mid_z usl_z)(/ (* mv (/ 1000 mg)) 1000)))))
		     (cons 11 (mapcar '+ t1! (list (*(+(/ 20 (/ 1000 mg))(calculation_str_long_be_h_stile (rtos mid_z 2 2) ht styl)(/ ht 4)(/ 1 (/ 1000 mg)))-1)
						   (/ (- mid_z usl_z)(/ (* mv (/ 1000 mg)) 1000)))))))
      (entmake (list '(0 . "TEXT")
		     (cons 10 (mapcar '+ t1! (list (*(+(/ 20 (/ 1000 mg))(calculation_str_long_be_h_stile (rtos mid_z 2 2) ht styl)(/ ht 4)(/ 1 (/ 1000 mg)))-1)
						   (+(/ (- mid_z usl_z)(/ (* mv (/ 1000 mg)) 1000))(/ ht 4)))))
		     (cons 40 ht)(cons 1 (rtos mid_z 2 2))(cons 7 styl)))
      ))
  (if 2Dpline
    (progn
      (setq spisokv (extract_coord_lwpolyline (entget 2Dpline)))
      (setq n (length spisokv))
      (setq dist (-(nth 0(nth (1- n) spisokv))(nth 0 t1!)))
      )
    (setq dist 500.00)
    )
  (mapcar '(lambda (x)
	     (entmake (list '(0 . "LINE") '(6 . "Continuous")
			    (cons 10 (mapcar '- t1! (list (/ 20 (/ 1000 mg)) (/ x (/ 1000 mg)))))
			    (cons 11 (mapcar '+ t1! (list dist (/ (- x (* x 2)) (/ 1000 mg)))))))
	     )
	  (cond
	    ((or(= q_sel_v_pr 0)(= q_sel_v_pr 1))
	     '(0 10 25 40 55 65 80 90 105 145 155 165 175 185)
	     )
	    ((= q_sel_v_pr 2)
	     '(0 15 30 45 55 65 80 95 105 115 125 135 150 160 170 180)
	     )
	    ((= q_sel_v_pr 3)
	     '(0 15 30 45 60 70 80 95 110 120 130 140 150 160)
	     )
	    ((= q_sel_v_pr 4)
	     '(0 15 30 45 60 75 85 95 105 115 130 135 140 150 155 175)
	     )
	    ((= q_sel_v_pr 5)
	     '(0 10 25 40 55 65 80 90 105 145 155 165 175 185 210 225 240 255 265)
	     )
	    )
	  )
  (cond
    ((or (= q_sel_v_pr 0) (= q_sel_v_pr 1) (= q_sel_v_pr 2) (= q_sel_v_pr 3)(= q_sel_v_pr 5))
     (entmake (list '(0 . "TEXT")  (cons 10 (mapcar '+ t1! (list (/ -42.896 (/ 1000 mg)) (/ 2.800 (/ 1000 mg)))))
		    (cons 40 (/ 4 (/ 1000 mg))) (cons 1 (rtos usl_z 2 2)) (cons 7 (getvar "TEXTSTYLE")))); число условный горизонт
     (entmake (list '(0 . "TEXT")  (cons 10 (mapcar '+ t1! (list (/ -60.534 (/ 1000 mg)) (/ 55.749 (/ 1000 mg)))))
		    (cons 40 (/ 4 (/ 1000 mg))) (cons 1 (strcat "1:" (rtos mv 2 0))) (cons 7 (getvar "TEXTSTYLE")))); масштаб вертикальный
     (entmake (list '(0 . "TEXT")  (cons 10 (mapcar '+ t1! (list (/ -60.534 (/ 1000 mg)) (/ 47.749 (/ 1000 mg)))))
		    (cons 40 (/ 4 (/ 1000 mg))) (cons 1 (strcat "1:" (rtos (* (/ 1 (/ 1000 mg)) 1000) 2 0)))
		    (cons 7 (getvar "TEXTSTYLE")))); масштаб горизонтальный
     )
    ((= q_sel_v_pr 4)
     (entmake (list '(0 . "TEXT")  (cons 10 (mapcar '+ t1! (list (/ -77.922 (/ 1000 mg)) (/ 3.392 (/ 1000 mg)))))
		    (cons 40 (/ 3 (/ 1000 mg))) (cons 1 (rtos usl_z 2 2)) (cons 7 (getvar "TEXTSTYLE")))); число условный горизонт
     (entmake (list '(0 . "TEXT")  (cons 10 (mapcar '+ t1! (list (/ -77.922 (/ 1000 mg)) (/ 12.991 (/ 1000 mg)))))
		    (cons 40 (/ 3 (/ 1000 mg))) (cons 1 (strcat "М 1:" (rtos mv 2 0))) (cons 7 (getvar "TEXTSTYLE")))); масштаб вертикальный
     (entmake (list '(0 . "TEXT")  (cons 10 (mapcar '+ t1! (list (/ -77.922 (/ 1000 mg)) (/ 17.991 (/ 1000 mg)))))
		    (cons 40 (/ 3 (/ 1000 mg))) (cons 1 (strcat "М 1:" (rtos (* (/ 1 (/ 1000 mg)) 1000) 2 0)))
		    (cons 7 (getvar "TEXTSTYLE")))); масштаб горизонтальный
     )
    )
  )
