- (defun c:tt (/ E MTEXT DIM DIMOBJ CP W H ROT STR TEXT)
- (while (and
- (setq e (nentsel "\n**选择标注文字:"))
- (setq mtext (car e))
- (= "MTEXT" (cdr (assoc 0 (setq mtext (entget mtext)))))
- )
- (setq text nil)
- (vla-GetBoundingBox
- (vlax-ename->vla-object (car e))
- 'll
- 'ur)
- (setq cp (mapcar '*
- '(0.5 0.5 0.5)
- (mapcar '+
- (vlax-safearray->list ll)
- (vlax-safearray->list ur))))
- (setq w (cdr (assoc 42 mtext))
- h (* 1.5 (cdr (assoc 43 mtext)))
- rot (cdr (assoc 50 mtext))
- )
- (entmake
- (list
- '(0 . "line")
- '(62 . 1)
- (cons 10
- (polar cp rot (* 0.6 w)))
- (cons 11
- (polar cp rot (* -0.6 w)))
- )
- )
- (while (/= "" (setq str (getstring "\n输入文字:")))
- (if (not text)
- (progn
- (entmake mtext)
- (setq text (entlast))
- (vla-move
- (vlax-ename->vla-object text)
- (vlax-3d-point cp)
- (vlax-3d-point (polar cp (+ rot (* 0.5 pi)) h)))
- (setq text (entget text))
- )
- (progn
- (setq text (subst (cons 1 str) (assoc 1 text) text))
- (entmod text)
- )
- )
- )
- )
- (princ)
- )
|