Jump to content

Interpolation lisp


onetxaggie

Recommended Posts

Searching all day, found some that were close and found someone looking for exactly what I am.


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 or a circle, etc
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

Thanks in advance
 

Edited by onetxaggie
Link to comment
Share on other sites

Sounds like you know a little about LISP programming so I will let you fill in the details

 

(getpoint ....) to get the first point

(getint ...) to enter the elevation as an integer (or getreal if you want a real number

and repeat

 

(setq mpt (mapcar '/ (mapcar '+ pt1 pt2) '(2 2 2))) gives you the mid point (thanks Mhupp),

(setq mpt (mapcar '/ (mapcar '+ pt1 pt2) '(3 3 3))) gives you 1/3rd distance.. No it doesn't - I've been corrected on this (much obliged). You could look here (

), my offering gives the coordinates of point A and B as a, b, c, d and you can work out distance between the 2 points divided by how many levels to get the points, or you could use the 2 points, the angle and distance between them to work out your n number of points (I don't have an example of that second method to hand though, but it might be a bit neater - angle in radians of course)

(

  (setq pt1 (list (* (+ a b) 0.25) (* (+ c d) 0.25) ))
  (setq pt2 (list (* (+ a b) 0.5) (* (+ c d) 0.5) ))
  (setq pt3 (list (* (+ a b) 0.75) (* (+ c d) 0.75) ))

as an example to split the distance into 4 sections))

 

 

 

So work out how many integers are between point 1 and 2 using (+ (- (* and (/, (fix will give you the integer value of that result

 

If you have more than 2 points you can do a loop to work out the mid points and can use (command "dtext".... to put in the text at the points calculated.

 

 

See how that helps, there should be enough in there to give you a hint but still let you think and learn from the problem, of course if that is no good ask again and perhaps on Monday when CAD is back on again I will make something up for you

 

 

 

Edited by Steven P
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...