# Thread: LOOKING FOR A LISP ROUTINE

1. Login to Give a bone

## Re: LOOKING FOR A LISP ROUTINE

Glad you all found a use for it.

2. Login to Give a bone

## Re: LOOKING FOR A LISP ROUTINE

After seeing what you can do with LISP, when are you going to start teaching Cab? I'd sign up for a series of classes if you taught them. I've always wanted to learn, but the books I've found don't seem to do it.

3. Login to Give a bone

## Re: LOOKING FOR A LISP ROUTINE

Thanks for the kind words.
There are lots of folks here that can teach lisp. I find I learn best by doing. Start a lisp & you will
get plenty of help & tips on how to compose your routine.
Be sure to read the two sticky topics in this forum. Lot of good stuff there.

4. Login to Give a bone

## Re: LOOKING FOR A LISP ROUTINE

Originally Posted by CAB2k
............. run perpendicular to a line between the first
and second picked points this will return an elevation for the third picked point.

.
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

5. Login to Give a bone

## Re: LOOKING FOR A LISP ROUTINE

here's a simple drawing with regards to my query above..thanks

6. Login to Give a bone

## Re: LOOKING FOR A LISP ROUTINE

This is an image for my routine above.

7. Login to Give a bone

## Re: LOOKING FOR A LISP ROUTINE

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)
)```

8. Login to Give a bone

## Re: LOOKING FOR A LISP ROUTINE

Forgot to attach my picture.

9. Login to Give a bone

## Re: LOOKING FOR A LISP ROUTINE

i'll run few samples tomorrow, i'll let you know of my feedback,

many thanks CAB

10. Login to Give a bone

## Re: LOOKING FOR A LISP ROUTINE

i ran a quick math here cab and its perfect..thank you very much.its a great use for me.

but on the other hand, not all roads are straight, some having loops and round abouts, i may still do it manually when it comes to those portions or if u have any idea about that..

more power.

Page 2 of 3 First 123 Last

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•