Jump to content
ybilgen

distance and elevation routine

Recommended Posts

ybilgen

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

 

)

Share this post


Link to post
Share on other sites
SLW210

Please read the Code Posting Guidelines and edit your Code to be included in Code Tags.[NOPARSE]

Your Code Here[/NOPARSE]

=

Your Code Here

Share this post


Link to post
Share on other sites
BIGAL

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×