试试这个
text、mtext都可以
(defun c:zz () (if (setq en_l (car (xentsel "请选择直线:" '((0 . "line"))))) (if (setq en_t (car (xentsel "请选择文本:" '((0 . "*text"))))) (progn (setq en_data (entget en_t)) (setq en_0 (entget en_l)) (if (equal (cdr (assoc 0 en_data)) "text") (setq n 51) (setq n 50) ) (setq ang (angle (cdr (assoc 10 en_0)) (cdr (assoc 11 en_0)) ) ) (if (> ang pi) (setq ang (- ang pi)) ) (setq en_data (subst (cons n ang) (assoc n en_data) en_data ) ) (entmod en_data) ) ) ) (prin1) )
(defun xentsel (txt plist / ss sn en) (setq ss (ssget "x" plist)) (setq sn 0) (while (zerop sn) (setq en (entsel (strcat "\n" txt))) (if (not en) (vl-exit-with-error "") ) (if (ssmemb (car en) ss) (setq sn 1) ) ) en ) |