Jump to content

distance and elevation routine


ybilgen
 Share

Recommended Posts

Hi guys,

Long time ago ,I have written this lisp routine,

This routine inputs a reference points coordinates, elevation and distance values from screen. It calculates several new points elevation and distance values and writes their elevation and distance values on screen.

 

Can anyone help me compiling this routine in to vba code

 

(defun C:x()

;We define the reference point

(command "osnap" "int")

(setq prop (getpoint "Define the reference point:"))

(setq propx (car prop))

(setq propy (cadr prop))

(setq n 100)

;We define the reference point elevation

(setq ropkot1 (entget (setq ropkot (car (entsel "\n Define the reference point elevation:")))))

(setq ropkot2 (cdr (assoc 1 ropkot1)))

(setq ropkoti (atof ropkot2))

;We define the reference point distance

(setq ropmes1 (entget (setq ropmes (car (entsel "\n Define the reference point distance:")))))

(setq ropmes2 (cdr (assoc 1 ropmes1)))

(setq ropmesi (atof ropmes2))

 

;We pick up the new point

(repeat n

(command "osnap" "end")

(setq p1 (getpoint "Define new point:"))

 

(setq p1x (car p1))

(setq p1y (cadr p1))

 

(command "osnap" "none")

(command "color" "white")

(command "line" (list p1x p1y) (list (+ p1x 1.575) (+ p1y 2.1)) "")

(command "line" (list (+ p1x 1.575) (+ p1y 2.1)) (list (- p1x 1.575) (+ p1y 2.1)) "")

(command "line" (list (- p1x 1.575) (+ p1y 2.1)) (list p1x p1y) "")

(setq m1 (- p1x propx))

(if (

 

(setq kot (+ ropkoti (/ (- p1y propy ) 10)))

(command "text" (list (- p1x 3.0) (+ p1y 2.5)) 1.8 0 (rtos kot 2 2))

(command "text" (list (+ p1x 0.75) (- p1y 7)) 1.8 90 (rtos (abs mesafe) 2 2))

 

)

Link to comment
Share on other sites

Why convert it if it works ? You can run a lisp from VBA code if thats the problem. Just find some VBA code examples you should be able to work it out.

 

Dim basepnt, pt1, pt2, pt3 As Variant
basepnt = ThisDrawing.Utility.GetPoint(, " Pick PIT center ")
ptxtx1 = CStr(FormatNumber(basepnt(0), 3))
ptxty1 = CStr(FormatNumber(basepnt(1), 3))
pt1 = ThisDrawing.Utility.GetPoint(, " Pick 1st point ")

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

 Share

×
×
  • Create New...