Originally Posted by
ron_09812001
if you picked a point that is non collinear with the first 2 points, does it assume the elevation of the point of intersection or does it have a slope also based on the first slope calculated?
cab, what if my 3rd point which is running perpendicular between the first and second picked points has a different slope from the point of intersection?this would be useful in my routine. elevations in roads are given in road center but what im after is the elevation above my water pipeline, there is a change in slope because the road center is always higher compared to areas near the curb/gutter.
-wizman07
See if this will work for your needs.
Code:
;; CAB 11.3.07
;; This one allows for a side slope
;; Pick Start & End points of main run & enter elevations.
;; Enter Lateral slope percentage. Example -2 = down 2%
;; Pick lateral point & routine calculates the elevation at that point
(defun c:SideSlope (/ p1 p2 p3 p4 el1 el2 el3 el4 d12 vecs tmpPt deltaE deltaE3
slope slo LatDis)
(and (setq p1 (getpoint "\nPick First point: "))
(setq el1 (getdist "\nEnter elevation."))
(setq p2 (getpoint p1 "\nPick Second point: "))
(setq el2 (getdist "\nEnter elevation."))
(setq slope (getdist "\nEnter lateral slope %. Example -2 = down 2%"))
(setq deltaE (- el2 el1)
d12 (distance p1 p2)
slo (/ slope 100.)
)
(while (setq p3 (getpoint "\nPick point for elevation: "))
(redraw)
(setq tmpPt (polar p3 (+ (/ pi 2) (angle p1 p2)) 10.0))
(setq p4 (inters p1 p2 p3 tmpPt nil))
(setq deltaE3 (* (/ (distance p1 p4) (distance p1 p2)) deltaE))
(if (> (distance p2 p4) d12)
(setq el3 (- el1 deltaE3))
(setq el3 (+ el1 deltaE3))
)
(setq LatDis (distance p3 p4) ; lateral Distance
el4 (+ (* LatDis slo) el3)
)
(grvecs (list 1 p1 p2 p3 p4))
(print (strcat "Elevation at intercept is " (rtos el3 2)))
(print (strcat "Elevation at point is " (rtos el4 2)))
)
)
(princ)
)