AutoLISP Help

I want to write a simple AutoLISP routine that will list the slope
between two entities be they points, nodes, polylines, 3dpolylines,
etc. I have the basic mathematics down, but I am having problems with
the remainder. Currently the program loads, but gets stuck in
initializing. I know I need to get the two points, but do not know
how to do this. Here is the program, can anyone help me finish it?
(defun ges( pt1 pt2 / dZ d Slope)
(setq
dZ (- (caddr pt2) (caddr pt1))
d (distance (list (car pt1) (cadr pt1) 0.0) (list (car pt2) (cadr
pt2) 0.0))
Slope (* 100.0 (/
dZ d))
)
)
Reply to
richardhighrange
Loading thread data ...
Try this:
(defun c:ges( / dZ d Slope) (setq Pt1 (getpoint "\nFirst point: ")) (setq Pt2 (getpoint Pt1 "\nSecond point: ")) (setq dZ (- (caddr pt2) (caddr pt1)) d (distance (list (car pt1) (cadr pt1) 0.0) (list (car pt2) (cadr pt2) 0.0)) Slope (* 100.0 (/ dZ d)) ) (princ (strcat "Slope= " (rtos Slope 2 2) "%")) (princ) )
Reply to
Carl AK

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.