你用了对齐方式,却没有设置对二对齐点,这样试试:
- (defun C:ADDNOTE (/ osvar start end middle rotate insert text pt pte)
- (setq osvar (getvar "osmode"))
- (setvar "osmode" 1)
- (setq start (getpoint "\n选取第1个点,"))
- (setq end (getpoint start " 选取第2个点"))
- (setq middle (list (+ (car start) (/ (- (car end) (car start)) 2))
- (+ (cadr start) (/ (- (cadr end) (cadr start)) 2))
- 0
- )
- )
- (setq rotate (angle start end))
- (setq insert (polar middle (+ rotate (angtof "90")) 5))
- (setvar "osmode" 0)
- (command "text" insert 5 (angtos rotate) "note")
- (setq text (entget (entlast)))
- (setq pt (cdr (assoc 10 text)))
- (setq pte (polar pt rotate (cdr (assoc 41 text))))
- (setq text (subst (cons 11 pte) (assoc 11 text) text))
- (setq text (subst (cons 72 1) (assoc 72 text) text))
- (setq text (subst (cons 73 1) (assoc 73 text) text))
- (entmod text)
- (setvar "osmode" osvar)
- (princ)
- )
|