# Thread: Surveying Bearing/Distance LISP Routine

1. 0 Did you find this post helpful? Yes

## Re: Surveying Bearing/Distance LISP Routine

You don't need a lisp routine in Civil3D. General/Add labels/ then choose Feature: Line and Curve. Pick the line to label the bearing and distance. Edit the Command Line in Toolspace/Settings/General/Label Style/Line to have the label the way you want it to show.

Of course, you must have a line first to label. I am using Civil3D 2009.

2. 0 Did you find this post helpful? Yes

## Re: Surveying Bearing/Distance LISP Routine

Originally Posted by hilln
You don't need a lisp routine in Civil3D. General/Add labels/ then choose Feature: Line and Curve. Pick the line to label the bearing and distance. Edit the Command Line in Toolspace/Settings/General/Label Style/Line to have the label the way you want it to show.

Of course, you must have a line first to label. I am using Civil3D 2009.
What about if I need to label just parts of that line and than again parts of that line. They should left the ability to put labels between two points.

3. 0 Did you find this post helpful? Yes

## Re: Surveying Bearing/Distance LISP Routine

Is there is a lisp function that writes bearing and distance in metric without the foot symbol and and quadrant bearings

4. 0 Did you find this post helpful? Yes

## Re: Surveying Bearing/Distance LISP Routine

Try this code, not seriously tested though
Code:
```;; local defuns

;;--------------------------------------------;;

;; draw text
(defun vk_true_text (txt t0 h ug just / elast)
(setq elast (entlast))
(if (= (cdr (assoc 40 (tblsearch "STYLE" (getvar "TEXTSTYLE")))) 0.0)
(if (/= (strcase just) "L")
(vl-cmdf "_.TEXT" "_J" just t0 h ug txt)
(vl-cmdf "_.TEXT" t0 h ug txt)
) ;_  if
(if (/= (strcase just) "L")
(vl-cmdf "_.TEXT" "_J" just t0 ug txt)
(vl-cmdf "_.TEXT" t0 ug txt)
) ;_  if
) ;_  if
(if (/= elast (entlast))
(entlast)
nil
) ;_  if
)
;;--------------------------------------------;;

; Convert value in radians to degrees
(defun rtd (a)
(* 180.0 (/ a pi))
)

;;-------------------------------------   main part   ---------------------------------;;
(defun C:BEAR(/ a ang b curth dist elist en ent gkw mp mp2 osm p1 p2 strang strdist txh)
(setq osm (getvar "osmode"))
(setvar "osmode" 0)
(setq curth (getvar "dimtxt"))
(initget 6)
(setq txh (getreal
(strcat "\nEnter the text height <" (rtos curth) ">: ")
)
)
(cond ((not txh) (setq txh curth)))

(initget 1 "Select Enter")
(setq gkw (getkword
"\nSelect line or Enter two points (Select/Enter) <S>: "
)
)
(if (eq "Select" gkw)
(progn
(setq ent (entsel "\nSelect line: "))
(setq en (car ent))
(setq elist (entget en))
(setq p1	  (cdr (assoc 10 elist))
p2	  (cdr (assoc 11 elist))
mp	  (mapcar '(lambda (a b) (/ (+ a b) 2)) p1 p2)
ang	  (angle p1 p2)

dist	  (distance p1 p2)
strdist (rtos dist 2 3)
strang  (angtos ang 0 2)
)

(if	(< (/ pi 2) ang (* pi 1.5))
(setq ang (+ pi ang))
)
(setq mp2 (polar mp (- ang (/ pi 2)) txh)
mp  (polar mp (+ (/ pi 2) ang) (/ txh 2))
)

(vk_true_text strdist mp txh (rtd ang) "BC")

(vk_true_text strang mp2 txh (rtd ang) "TC")

)
(progn
(setq p1 (getpoint "\nSpecify a first point: "))
(setq p2 (getpoint p1 "\nSpecify a second point: "))
(setq mp	  (mapcar '(lambda (a b) (/ (+ a b) 2)) p1 p2)
ang	  (angle p1 p2)

dist	  (distance p1 p2)
strdist (rtos dist 2 3)
strang  (angtos ang 0 2)
)
(if	(< (/ pi 2) ang (* pi 1.5))
(setq ang (+ pi ang))
)
(setq mp2 (polar mp (- ang (/ pi 2)) txh)
mp  (polar mp (+ (/ pi 2) ang) (/ txh 2))
)

(vk_true_text strdist mp txh (rtd ang) "BC")

(vk_true_text strang mp2 txh (rtd ang) "TC")
)
)

(setvar "osmode" osm)
(princ)
)

(prompt "\nType BEAR to start command")
(prin1)```
~'J'~

5. 0 Did you find this post helpful? Yes

## Re: Surveying Bearing/Distance LISP Routine

Originally Posted by fixo
Try this code, not seriously tested though
Code:
```;; local defuns

;;--------------------------------------------;;

;; draw text
(defun vk_true_text (txt t0 h ug just / elast)
(setq elast (entlast))
(if (= (cdr (assoc 40 (tblsearch "STYLE" (getvar "TEXTSTYLE")))) 0.0)
(if (/= (strcase just) "L")
(vl-cmdf "_.TEXT" "_J" just t0 h ug txt)
(vl-cmdf "_.TEXT" t0 h ug txt)
) ;_  if
(if (/= (strcase just) "L")
(vl-cmdf "_.TEXT" "_J" just t0 ug txt)
(vl-cmdf "_.TEXT" t0 ug txt)
) ;_  if
) ;_  if
(if (/= elast (entlast))
(entlast)
nil
) ;_  if
)
;;--------------------------------------------;;

; Convert value in radians to degrees
(defun rtd (a)
(* 180.0 (/ a pi))
)

;;-------------------------------------   main part   ---------------------------------;;
(defun C:BEAR(/ a ang b curth dist elist en ent gkw mp mp2 osm p1 p2 strang strdist txh)
(setq osm (getvar "osmode"))
(setvar "osmode" 0)
(setq curth (getvar "dimtxt"))
(initget 6)
(setq txh (getreal
(strcat "\nEnter the text height <" (rtos curth) ">: ")
)
)
(cond ((not txh) (setq txh curth)))

(initget 1 "Select Enter")
(setq gkw (getkword
"\nSelect line or Enter two points (Select/Enter) <S>: "
)
)
(if (eq "Select" gkw)
(progn
(setq ent (entsel "\nSelect line: "))
(setq en (car ent))
(setq elist (entget en))
(setq p1	  (cdr (assoc 10 elist))
p2	  (cdr (assoc 11 elist))
mp	  (mapcar '(lambda (a b) (/ (+ a b) 2)) p1 p2)
ang	  (angle p1 p2)

dist	  (distance p1 p2)
strdist (rtos dist 2 3)
strang  (angtos ang 0 2)
)

(if	(< (/ pi 2) ang (* pi 1.5))
(setq ang (+ pi ang))
)
(setq mp2 (polar mp (- ang (/ pi 2)) txh)
mp  (polar mp (+ (/ pi 2) ang) (/ txh 2))
)

(vk_true_text strdist mp txh (rtd ang) "BC")

(vk_true_text strang mp2 txh (rtd ang) "TC")

)
(progn
(setq p1 (getpoint "\nSpecify a first point: "))
(setq p2 (getpoint p1 "\nSpecify a second point: "))
(setq mp	  (mapcar '(lambda (a b) (/ (+ a b) 2)) p1 p2)
ang	  (angle p1 p2)

dist	  (distance p1 p2)
strdist (rtos dist 2 3)
strang  (angtos ang 0 2)
)
(if	(< (/ pi 2) ang (* pi 1.5))
(setq ang (+ pi ang))
)
(setq mp2 (polar mp (- ang (/ pi 2)) txh)
mp  (polar mp (+ (/ pi 2) ang) (/ txh 2))
)

(vk_true_text strdist mp txh (rtd ang) "BC")

(vk_true_text strang mp2 txh (rtd ang) "TC")
)
)

(setvar "osmode" osm)
(princ)
)

(prompt "\nType BEAR to start command")
(prin1)```
~'J'~
FIXO; I believe the angle reported by the program is the complement of the angle which needs to be reported. Angle needs to be reported from north or south, not east or west. (angle reported as 16.8 degrees, should be 73.2 degrees)
Steve

6. 0 Did you find this post helpful? Yes

## Re: Surveying Bearing/Distance LISP Routine

Thank you Steve, but I'm not a math, I'm still waiting for OP response
He wrote:
>>
Is there is a lisp function that writes bearing and distance in metric without the foot symbol and and quadrant bearings
Oleg

7. 0 Did you find this post helpful? Yes

## Re: Surveying Bearing/Distance LISP Routine

Hey, guys

I need a lisp that label the azimuth & distance by picking a line?
The azimuth is according to the position of UCS from the AutoCad2012.

Kind Regards,

8. 0 Did you find this post helpful? Yes

## Re: Surveying Bearing/Distance LISP Routine

Originally Posted by fabricio_camargo84151122
Hey, guys

I need a lisp that label the azimuth & distance by picking a line?
The azimuth is according to the position of UCS from the AutoCad2012.
Take a look at
http://forums.autodesk.com/t5/Visual...e/td-p/2668454

9. 0 Did you find this post helpful? Yes

## Re: Surveying Bearing/Distance LISP Routine

See file below.

10. 0 Did you find this post helpful? Yes

## Re: Surveying Bearing/Distance LISP Routine

modelo.dwg

Hello guys,
Thanks for the help but I saw this lisp and didn't work.
I need lisp that give me azimuth and distance: e.g. 25°26'23" - 15,30m.

Following attached file as a model.
Thanks.

Page 3 of 5 First 12345 Last

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•