Jump to content

Interpolation Lisp Needed


johnshar123xx

Recommended Posts

i am not understand . kindly see the attachment. i need this type interpolation in grid pattern. 

please please please help me.

elevation in value mention in grid pattern.

 

 

 

 

interpolation in grid.jpg

Survey_Engineering_v2.VLX

Edited by sudam
this VLX CAN convert in lisp?
Link to comment
Share on other sites

Sir, i am new in lisp . kindly see the attachment. i need this type interpolation in grid pattern. 

please please please help me.

elevation in value mention in grid pattern.

Anyone can help me.

 

Thank you.

 

 

 

Sample.dwg

Edited by sudam
Link to comment
Share on other sites

  • 1 month later...
On 1/24/2018 at 3:37 PM, netelaana said:

I would like to exit the while loop and then delete the line with , but I can't get it to work yet with multiple instances. the closest I can get is this

 

 


;interpolation function to populate text elevation labels 
; written by Nete Laana on 24.01.18
(defun c:INTEL (/ p1 p2 p3 el1 el2 el3 dista distb distc h1 prod r1 t1) ;define the function intel
(setq p1 (getpoint "\nPick First Point : "));get the first point
(setq el1 (getreal "\nSpecify First Elevation : "));manually enter first elevation
(setq p2 (getpoint "\nPick Second Point : "));get the second point
(setq el2 (getreal "\nSpecify Second Elevation : "));manually enter second elevation
(command "Line" p1 p2 "");draw the line
(setq p3 (getpoint "\ns Pick Interpolation Point : ")); pick desired interpolation point
(setq distb (distance p1 p3)); calculate distance a
(setq distc (distance p2 p3)); calculate distance b
(setq dista (+ distb distc)); calculate total distance
(setq h1 (- el2 el1)); calculate height difference
(setq prod (* h1 distb)); numerator
(setq r1 (/ prod dista)); relative height 
(setq el3 (+ r1 el1));calculate interpolated elevation
(setq t1 (rtos el3 2 2)); convert to text string rounded to two digits
(entdel (entlast)); delete the line
(command "circle" p3 0.15); draw circle to identify point
(command ".TEXT" p3 1.2 0 t1); dump el3 as text object
;(print (strcat "Elevation at point is " (rtos el3)))
;(print (strcat "distb " (rtos distb)))
;(print (strcat "distc " (rtos distc)))
;(print (strcat "dista " (rtos dista)))
;(print (strcat "h1 " (rtos h1)))
;(print (strcat "el1 " (rtos el1)))
;(print (strcat "el2 " (rtos el2)))
;(print (strcat "prod " (rtos prod)))
;(print (strcat "r1 " (rtos r1)))
;(print (strcat "t1 " t1))
(princ)
) 
 

is it possible to change this lisp so we choose between manually enter elevation AND pick written text with Z value?
It will be much more easier to click on text containing Z value than manualy typing values for every point. Tnx

 

 

Link to comment
Share on other sites

Try this. Modified lisp slightly

(defun rh:get_elev ( msg / ss rtn)
  (prompt msg)
  (setq ss (ssget "_+.:E:S" '((0 . "TEXT"))))
  (cond ( (not ss) 
          (initget 3)
          (setq rtn (getreal "\nEnter Level : "))
        )
        (t
          (setq rtn (atof (cdr (assoc 1 (entget (ssname ss 0))))))
        )
  );end_cond
);end_defun  

;interpolation function to populate text elevation labels 
; written by Nete Laana on 24.01.18 Modified dlanorh 30.04.19
(defun c:INTEL (/ p1 p2 p3 e1 e2 e3 d1 d2) ;define the function intel
  (while (setq p1 (getpoint "\nPick First Point : "));get the first point
    (setq e1 (rh:get_elev "\nSpecify First Elevation : ");get first elevation
          p2 (getpoint "\nPick Second Point : ");get the second point
          e2 (rh:get_elev "\nSpecify Second Elevation : ");get second elevation
          d1 (distance p1 p2); calculate total distance
    );end_setq
    (command "Line" p1 p2 "");draw the line
    (setq p3 (getpoint "\nPick Interpolation Point : "); pick desired interpolation point
          d2 (distance p1 p3); calculate distance a
          e3 (+ (/ (* (- e2 e1) d2) d1) e1);calculate interpolated elevation
    );end_setq
    (entdel (entlast)); delete the line
    (command "circle" p3 0.15); draw circle to identify point
    (command ".TEXT" p3 1.2 0 (rtos e3 2 2)); dump e3 as text object
    (setq p1 nil)
  );end_while  
(princ)
);end_defun
 

 

The lisp will now loop and ask for the next "Pick First Point  : ". To exit the loop press return or click the right mouse button if it is set up that way.

Edited by dlanorh
Edited code
  • Like 2
Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...

thank you for this LSP

really appreciate it..

 

can I ask one more thing..is it ok to modify this so that the output value would be in 3 decimal places

currently its on 2 decimal places,.

 

thanks

 

On ‎4‎/‎30‎/‎2019 at 5:39 PM, dlanorh said:

Try this. Modified lisp slightly


(defun rh:get_elev ( msg / ss rtn)
  (prompt msg)
  (setq ss (ssget "_+.:E:S" '((0 . "TEXT"))))
  (cond ( (not ss) 
          (initget 3)
          (setq rtn (getreal "\nEnter Level : "))
        )
        (t
          (setq rtn (atof (cdr (assoc 1 (entget (ssname ss 0))))))
        )
  );end_cond
);end_defun  

;interpolation function to populate text elevation labels 
; written by Nete Laana on 24.01.18 Modified dlanorh 30.04.19
(defun c:INTEL (/ p1 p2 p3 e1 e2 e3 d1 d2) ;define the function intel
  (while (setq p1 (getpoint "\nPick First Point : "));get the first point
    (setq e1 (rh:get_elev "\nSpecify First Elevation : ");get first elevation
          p2 (getpoint "\nPick Second Point : ");get the second point
          e2 (rh:get_elev "\nSpecify Second Elevation : ");get second elevation
          d1 (distance p1 p2); calculate total distance
    );end_setq
    (command "Line" p1 p2 "");draw the line
    (setq p3 (getpoint "\nPick Interpolation Point : "); pick desired interpolation point
          d2 (distance p1 p3); calculate distance a
          e3 (+ (/ (* (- e2 e1) d2) d1) e1);calculate interpolated elevation
    );end_setq
    (entdel (entlast)); delete the line
    (command "circle" p3 0.15); draw circle to identify point
    (command ".TEXT" p3 1.2 0 (rtos e3 2 2)); dump e3 as text object
    (setq p1 nil)
  );end_while  
(princ)
);end_defun
 

 

The lisp will now loop and ask for the next "Pick First Point  : ". To exit the loop press return or click the right mouse button if it is set up that way.

Link to comment
Share on other sites

6 hours ago, dek said:

thank you for this LSP

really appreciate it..

 

can I ask one more thing..is it ok to modify this so that the output value would be in 3 decimal places

currently its on 2 decimal places,.

 

thanks

 

 

Unsure of what you are after. It's not my lisp, I just modified it. If you want to do it yourself, be my guest. If you don't or don't know how, find this line

 

(command ".TEXT" p3 1.2 0 (rtos e3 2 2)); dump e3 as text object

 

and change it to

 

(command ".TEXT" p3 1.2 0 (rtos e3 2 3)); dump e3 as text object

 

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...