(defun c:sd (/ p1 p2 dX dY) ;Modified and recreated by Igal Averbuh 2015

(and

(setq p1 (getpoint "\nEnter first point: "))

(setq p2 (getpoint p1 "\nEnter second point: "))

(setq dX (- (car p2) (car p1)))

(setq dY (- (cadr p2) (cadr p1)))

(not (equal p1 p2))
(setq h1 (last pt1)
h2 (last pt2)
p1 (reverse (cdr (reverse p1)))
p2 (reverse (cdr (reverse p2)))
d12 (distance p1 p2)
ang (angle p1 p2)
ptm (polar p1 ang (/ d12 2))))

(command "_-text" "_j" "_bc" "_none" ptm 1 (angtos ang)
(strcat "Slope = " (rtos (if ( dY 0) (abs (* 100 (/ dY dX)))(* -100 (/ dY dX))) (* 100 (/ dY dX))))"%")

(princ

(strcat

"\nDistance = "

(rtos (distance p1 p2))

"\t Delta X = "

(rtos dX)

"\t Delta Y = "

(rtos dY)

(if (zerop dX)

"\t Vertical"

(strcat

"\t Slope = "

(rtos

(if ( dY 0) (abs (* 100 (/ dY dX)))

(* -100 (/ dY dX)))

(* 100 (/ dY dX))))

"%"

)

)

)

)

)

(princ)

)
(c:sd)

Advertisements