- ;; tt(文字定点在直线方格中心位置)
- (defun c:tt ()
- ;; 文字中心点
- (defun txtmpt (s1 / en box p10 p1)
- (setq en (entget s1)
- box (textbox en)
- p10 (cdr (assoc 10 en))
- p1 (mapcar '(lambda (x y) (* (+ x y) 0.5))
- (car box)
- (cadr box)
- )
- )
- (mapcar '(lambda (x y) (+ x y)) p10 p1)
- )
- (command "undo" "begin")
- (setq ss (ssget '((0 . "TEXT")))
- n -1
- )
- (while (setq s1 (ssname ss (setq n (1+ n))))
- (setq ptm (trans (txtmpt s1) 0 1))
- (bpoly ptm)
- (setq s2 (entlast)
- ptn (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget s2))
- ptn (mapcar 'cdr ptn)
- pt (mapcar '(lambda (x y) (* (+ x y) 0.5))
- (car ptn)
- (caddr ptn)
- )
- )
- (entdel s2)
- (command "move" s1 "" "non" ptm "non" pt)
- )
- (command "undo" "end")
- (princ)
- )
|