Lots of suggestions re coding the first rule is that brg dist is always based on the direction of the two pick points, this way no need for pick mid as this is implied and always out. The text point is from the middle plus a fudge factor times the text height use txt middle centre this way appears neatly. The text angle needs to be checked to ensure read from bottom or right.
Code:
This line can cause problems if you imply radians for any reason it will stuff up.
(setq ang (- 90.0 (/ (* (angle pt1 pt2) 180.0) pi)))
(setq oldsnap (getvar 'osmode)) remember old setting
(command "osnap" "")
(setvar 'osmode 0) better than command method
Use a layer table search rather than make layer everytime this way done once, better still have this layer in your template.
Re the angle of the text if you look into these variables
Aunits
Angdir
you can work out which quadrant your in and check the angle so always right& up
Check out using polar (polar (polar pt1 ang (/ dist 2.0)) (+ (/pi 2.0) (* b 2))
note the 90 angle needs to be checked
As much as I would like to post its copyrited.