I'm trying to make some mods to this handy routine created by Keith. Here's a rundown on what the routine does:
INL = calcs lower invert calc
INU = calcs upper invert calc
SLO = calcs slope of line
In regards to the INU, INU & SLO functions, how can i modify to do the following:
1. prompt user to draw pline in lieu of selecting a single line for calculations
2. prompt user to pick text insertion point & rotation angle for slope label in
lieu of defaulting to midpoint of selected line & 0 rotation
(defun INV( Pos1 Pos2 / a b c d e f a10 a11 slopeins result insp slop oce)
(setq oce (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq a (entsel (strcat "\nSelect " Pos1 " elevation: ")))
(setq b (cdr (assoc 1 (entget (car a)))))
(setq c (distof b))
(setq d (entsel "\nSelect line: "))
(setq slop (getreal "\nEnter slope percentage: "))
(setq e (entget (car d)))
(setq a10 (cdr (assoc 10 e)))
(setq a11 (cdr (assoc 11 e)))
(setq f (distance a10 a11))
(setq slopeins (list (/(+(car a10)(car a11))2)
(+(/(+(cadr a10)(cadr a11))2)(* (getvar "textsize")2))
0.0))
(if (>(cdr(assoc 40 (tblsearch "style" (getvar "textstyle"))))0)
(command "_text" "j" "mc" slopeins "" (strcat(rtos slop 2 2)"%"))
(command "_text" "j" "mc" slopeins "" "" (strcat(rtos slop 2 2)"%"))
)
(if (= Pos1 "Upper")
(setq result (rtos (- c (/(* f slop)100))2))
(setq result (rtos (+ c (/(* f slop)100))2))
)
(setq insp (getpoint (strcat "\nSelect " Pos2 " elevation insertion point: ")))
(if (>(cdr(assoc 40 (tblsearch "style" (getvar "textstyle"))))0)
(command "_text" "j" "mc" insp "" result)
(command "_text" "j" "mc" insp "" "" result)
)
(setvar "cmdecho" oce)
(princ)
)
(defun C:SLO( / a aa b bb c cc d e f a10 a11 slopeins result oce)
(setq oce (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq a (entsel "\nSelect Upper elevation: "))
(setq b (cdr (assoc 1 (entget (car a)))))
(setq c (distof b))
(setq aa (entsel "\nSelect Lower elevation: "))
(setq bb (cdr (assoc 1 (entget (car aa)))))
(setq cc (distof bb))
(setq d (entsel "\nSelect line: "))
(setq e (entget (car d)))
(setq a10 (cdr (assoc 10 e)))
(setq a11 (cdr (assoc 11 e)))
(setq f (distance a10 a11))
(setq slopeins (list (/(+(car a10)(car a11))2)
(+(/(+(cadr a10)(cadr a11))2)(* (getvar "textsize")2))
0.0))
(setq result (/(- c cc)(/ f 100)))
(if (>(cdr(assoc 40 (tblsearch "style" (getvar "textstyle"))))0)
(command "_text" "j" "mc" slopeins "" (strcat(rtos result 2 2)"%"))
(command "_text" "j" "mc" slopeins "" "" (strcat(rtos result 2 2)"%"))
)
(setvar "cmdecho" oce)
(princ)
)
(defun C:INL()
(INV "Upper" "Lower")
)
(defun C:INU()
(INV "Lower" "Upper")
)
(defun C:INV()
(INV "Upper" "Lower")
)
(princ)
(princ "\n-----> INL to run lower invert calc")
(princ "\n-----> INU to run upper invert calc")
(princ "\n-----> SLO to run slope calc")