(defun c:mini_gxgz (/ old_cmd ang e mpt)
  (mini_start nil)
  (mai_last_com "mini_gxgz")
  (princ "\n单行文本改斜归正")
  (setq e (mai_select_first '((0 . "TEXT")) "选择要改斜归正的单行文本实体:" "没有选择物体."))
  (foreach e (mai_ssget_2_list e)
    (setq box (mai_text_box e)
          mpt (mai_divide_point (car box) (caddr box) 0.5)
          ang (angle (car box) (cadr box))
    )
    (if (or    (equal ang (* 1.5 pi) 0.01)
            (> (* 1.5 pi) ang (* 0.5 pi))
        )
        (vla-rotate (vlax-ename->vla-object e) (vlax-3d-point (list (car mpt) (cadr mpt) 0.0)) pi)
    )
  )
  (mai_end)
)