Author Topic: Tough Questions - Grading Slope and Elevation Calculating Lisp  (Read 5474 times)

0 Members and 1 Guest are viewing this topic.

johnshar123xx

  • Guest
Tough Questions - Grading Slope and Elevation Calculating Lisp
« on: November 30, 2009, 02:22:15 PM »
Tough Questions - Grading Slope and Elevation Calculating Lisp


AutoCAD 2007
I have a quite a few tough questions/requests and I am currently looking for some lisps to solve them.  I have been doing some searching online to find the lisps I need, and although I have been able to find some stuff, I still have some things that I can't seem to find exactly what I am looking for.  I would like to take the opportunity ahead of time to thank every who views my questions and for any help that is given.

Looking for a couple of lisps for grading a site

1.) For the first lisp I am looking for one that calculates the slope between two points in this order...
-click on first point
-if the first point was clicked on a contour line that has a "Z" elevation set to it use it - IF NOT (Z elevation of line set to zero) - ask to manually give elevation for that first point
-click on second point
-if the second point was clicked on a contour line that has a "Z" elevation set use it - IF NOT (Z elevation of line set to zero) - ask to manually give elevation for that second point
-have the lisp take the distance between the two points with the elevations given and calculate the slope between the two points (giving you the slope % or decimal or both would be great)

2.) The next lisp I am looking for is one that produces an elevation of the second point in this order...
-click on first point
-enter the elevation of the first point
-click on second point
-enter the slope in %       
Example:    1% which will equal a increase slope, adding the increase in elevation to the first point elevation given
      -1% which will equal a decrease slope, subtracting the decrease in elevation from the first point elevation given
-have the lisp calculate the elevation of the second point you clicked

3.) Last but not least I am looking for an interpolation lisp that has steps in this order...
-click on first point
-enter elevation of the first point
-click on second point
-enter elevation of the second point
-have the lisp place a letter "x" based on current text style (with a middle center insertion point at its center) at all the whole numbers between the two points
For example if the first point = elevation 120.50 and the second point = elevation 123.00.  The lisp will place an "X" between the two points clicked at elevation 121.00 and at 122.00


Who is up for the challenge?

Willie

  • Swamp Rat
  • Posts: 958
  • Going nowhere slowly
Soli Deo Gloria | Qui Audet Adipiscitur
Windows 8  64-bit Enterprise | Civil 3D 2015 and 2016| ArcGIS 10.1
Yogi Berra : "I'd give my right arm to be ambidextrous."

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Tough Questions - Grading Slope and Elevation Calculating Lisp
« Reply #2 on: December 01, 2009, 09:19:19 AM »
Code: [Select]
;;; Calculate grade of unknown point
;;; Alan J. Thompson
(defun c:GRADE (/ #Dist #Elev #Grade #NewElev)
  (cond
    ((and (setq #Dist (getdist "\nDistance: "))
          (setq #Elev (getreal "\nElevation of known point: "))
          (setq #Grade (getreal "\nPercent grade (eg: 0.25 for 0.25%): "))
     ) ;_ and
     (setq #NewElev (strcat "\nElevation: "
                            (rtos (+ (* #Dist (/ #Grade 100)) #Elev) 2 3)
                    ) ;_ strcat
     ) ;_ setq
     (princ #NewElev)
     (alert #NewElev)
    )
  ) ;_ cond
  (princ)
) ;_ defun
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

johnshar123xx

  • Guest
Re: Tough Questions - Grading Slope and Elevation Calculating Lisp
« Reply #3 on: December 02, 2009, 03:44:57 PM »
Hey guys, thank you so much for your replies.
Those appear to be two great links I have not come across and the answer given for my question #2 is exactly what I was looking for.  I really appreciate the help, thank you.