What your missing maybe, "is pline CW or CCW, can reverse pline then text will always go out.
(defun Chkcwccw (ent / obj obj2 area1 area2)
(setq ent (entsel "\nPick closed pline "))
(setq obj (vlax-ename->vla-object ent))
(setq area1 (vlax-get obj 'Area))
(vla-offset obj 10)
(setq obj2 (vlax-ename->vla-object (entlast)))
(setq area2 (vlax-get obj2 'Area))
(vla-delete obj2)
(if (> area1 area2)
(command "reverse" ent "")
; (command "pedit" ent "R" "") ; Bricscad has no reverse
)
(setq ent (entsel "\nPick closed pline "))
(Chkcwccw ent)
Thanks to Lee-mac for readable.
;; Make Readable - Lee Mac
;; Returns a given angle corrected for text readability
(defun lm:makereadable (a)
((lambda (a)
(if (and (< (* pi 0.5) a) (<= a (* pi 1.5)))
(+ a pi)
a
)
)
(rem (+ a pi pi) (+ pi pi))
)
)