我试着把层名放在线的中间(而不是中点)。还有,我怎样才能得到所选线条的角度,这样我就可以把文字平行于所选线条。谢谢
(defun mip-text-entmake (txt pnt height rotation justification / ent_list) ;;; borrowed from ShaggyDoc ;;; http://www.caduser.ru/forum/index.php?PAGE_NAME=read&FID=23&TID=30276 (setq ent_list (list '(0 . "TEXT") '(100 . "AcDbEntity") '(100 . "AcDbText") (list 10 (car pnt) (cadr pnt) 0.0) (cons 1 txt) (cons 40 height) (cons 7 (getvar "TEXTSTYLE")) (if justification (cond ((= justification "C") '(72 . 1) ) ((= justification "R") '(72 . 2) ) ((= justification "A") '(72 . 3) ) ((= justification "M") '(72 . 4) ) ((= justification "F") '(72 . 5) ) (t '(72 . 0) ) ) ;_ end of cond '(72 . 0) ) ;_ end of if (cons 50 rotation) (list 11 (car pnt) (cadr pnt) 0.0) ) ;_ end of list ) ;_ end of setq (setq ent_list (entmakex ent_list)))(defun C:TEST (/ selobj #line) (setq selobj (entsel)) (setq #line (cdr (assoc 8 (entget (car selobj))))) (and (setq pt (getpoint "\nPick center text point: ")) (setq pt (trans pt 1 0)) (mip-text-entmake #line ;;; text pt ;;; point (getvar "TEXTSIZE") ;;; heigth [color="red"]0[/color] ;;; rotation "C" ;;; justification ) ) )