YMG,
I have written code for labeling contours by simply picking a point on the contour and writing its elevation at that spot. Drag-Lines are cool, but I rarely have an occasion where they are applicable. I am always having to dodge other data and objects on the drawing.
The following is a rework to your mk_mtext. I have simply added masking to it for my application.
;; mk_mtext by ymg *** modified as mk_masked_text by rw2691 for masking *** ;
;; Arguments: p, Insertion Point. ;
;; s, Text. ;
;; j, Justification: ;
;; 1 = Top left; 2 = Top center; 3 = Top right; ;
;; 4 = Middle left; 5 = Middle center; 6 = Middle right; ;
;; 7 = Bottom left; 8 = Bottom center; 9 = Bottom right ;
;; h, Text Height. ;
;; r, Rotation. ;
;; c, text color ;
;; ms, mask state ...1=on 2=off ;
;; mc, mask color ...1, 7, or 254 slight-gray or ash ;
;; mr, mask ratio ...typical is 1.4 ;
;; Limitation: 255 character string for text
(defun mk_masked_text (p s j h r c ms mc mr)
(if (= ms nil) (setq ms 2 mc 1 mr 1.4))
(entmakex
(list (cons 0 "MTEXT")
(cons 100 "AcDbEntity")
(cons 100 "AcDbMText")
(cons 10 p) ;; point
(cons 71 j) ;; justify
(cons 40 h) ;; height
(cons 50 r) ;; rotate by radians 0=right pi=left
(cons 1 s) ;; string
(cons 62 c) ;; color 256=bylayer 0=byblock negative=layeroff
(cons 90 ms) ;; mask state ;; 1 is mask-on ... 2 is mask-off
(cons 63 mc) ;; mask color ;; 1 is red, 7 white, 254 ash, etc.
(cons 45 mr) ;; mask ratio ;; 1.0 is text height, 1.4 is 0.4 larger than text height
)
)
)
Rick