B
bmossman
What lines do i have to add in order to be able to draw a pline & use it's length value in the following calculations in lieu of just drawing a single line?
(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 p1 (getpoint "\nDraw the line, Enter starting point: "))
(setq p2 (getpoint p1 "\nEnter end point: "))
(if (and p1 p2)
(command "._line" p1 p2 "")
(quit)
)
(setq e (entget(entlast)))
;(setq e (entget (car d)))
(setq slop (getreal "\nEnter slope percentage: "))
(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))
(prompt "\nSelect location and angle for slope.")
(if (>(cdr(assoc 40 (tblsearch "style" (getvar "textstyle"))))0)
(command "_text" "j" "mc" pause pause (strcat(rtos slop 2 2)"%"))
(command "_text" "j" "mc" pause "" pause (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 p1 (getpoint "\nDraw the line, Enter starting point: "))
(setq p2 (getpoint p1 "\nEnter end point: "))
(if (and p1 p2)
(command "._line" p1 p2 "")
(quit)
)
(setq e (entget(entlast)))
(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)))
(prompt "\nSelect location and angle for slope.")
(if (>(cdr(assoc 40 (tblsearch "style" (getvar "textstyle"))))0)
(command "_text" "j" "mc" pause pause (strcat(rtos result 2 2)"%"))
(command "_text" "j" "mc" pause "" pause (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")
(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 p1 (getpoint "\nDraw the line, Enter starting point: "))
(setq p2 (getpoint p1 "\nEnter end point: "))
(if (and p1 p2)
(command "._line" p1 p2 "")
(quit)
)
(setq e (entget(entlast)))
;(setq e (entget (car d)))
(setq slop (getreal "\nEnter slope percentage: "))
(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))
(prompt "\nSelect location and angle for slope.")
(if (>(cdr(assoc 40 (tblsearch "style" (getvar "textstyle"))))0)
(command "_text" "j" "mc" pause pause (strcat(rtos slop 2 2)"%"))
(command "_text" "j" "mc" pause "" pause (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 p1 (getpoint "\nDraw the line, Enter starting point: "))
(setq p2 (getpoint p1 "\nEnter end point: "))
(if (and p1 p2)
(command "._line" p1 p2 "")
(quit)
)
(setq e (entget(entlast)))
(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)))
(prompt "\nSelect location and angle for slope.")
(if (>(cdr(assoc 40 (tblsearch "style" (getvar "textstyle"))))0)
(command "_text" "j" "mc" pause pause (strcat(rtos result 2 2)"%"))
(command "_text" "j" "mc" pause "" pause (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")