Hi,
As usual, I'm not certain to understand the request, but here's a little routine wich returns the 4 points WCS coordinates of the 'bounding frame' of a Mtext.
It works whatever the mtext justification, rotation, and building frame.
;; MTextBoundingFrame (gile)
;; Returns the bounding frame of a Mtext (WCS coordinates)
;;
;; Argument
;; mtext: the mtext ename
(defun MtextBoundingFrame
(mtext / elst nor ref rot wid hgt jus org lst mat)
(setq elst (entget mtext)
nor (cdr (assoc 210 elst))
ref (trans (cdr (assoc 10 elst)) 0 nor)
rot (angle '(0 0 0) (trans (cdr (assoc 11 elst)) 0 nor))
wid (cdr (assoc 42 elst))
hgt (cdr (assoc 43 elst))
jus (cdr (assoc 71 elst))
org (list
(cond
((member jus '(2 5 8)) (/ wid -2))
((member jus '(3 6 9)) (- wid))
(T 0.0)
)
(cond
((member jus '(1 2 3)) (- hgt))
((member jus '(4 5 6)) (/ hgt -2))
(T 0.0)
)
)
lst (mapcar
(function
(lambda (p)
(mapcar '+ org p)
)
)
(list
(list 0. 0.)
(list wid 0.)
(list wid hgt)
(list 0. hgt)
)
)
mat (list (list (cos rot) (- (sin rot)) 0)
(list (sin rot) (cos rot) 0)
'(0 0 1)
)
lst (mapcar
(function
(lambda (p)
(trans (mapcar '+ (mxv mat p) (list (car ref) (cadr ref)))
nor
0
)
)
)
lst
)
)
)
;; Apply a transformation matrix to a vector by Vladimir Nesterovsky
(defun mxv (m v)
(mapcar (function (lambda (r) (apply '+ (mapcar '* r v)))) m)
)