改改还可以这样,完成一个文字的拷贝,右键,再选择另一个文字操作
- ;;;拷贝文字随线角度 by x_s_s_1@163.com
- (defun c:ctb (/ ent enl pt1 pt2 mid_pt ang)
- (defun emk_t (layer pt1 pt2 text ang n72 n73 h w sty /)
- (entmake (list '(0 . "text")
- '(100 . "AcDbEntity")
- (cons 8 layer)
- '(100 . "AcDbText")
- (cons 10 pt1)
- (cons 1 text)
- (cons 40 h)
- (cons 41 w)
- (cons 7 sty)
- (cons 72 n72)
- (cons 11 pt2)
- (cons 50 ang)
- (cons 73 n73)
- )
- )
- )
- (while
- (setq ent (car (entsel "\n选择文字:")))
- (if (= "TEXT" (cdr (assoc 0 (entget ent))))
- (progn
- (while (setq enl (car (entsel "\n选择对齐线:")))
- (if (= "LINE" (cdr (assoc 0 (entget enl))))
- (progn
- (setq pt1 (cdr (assoc 10 (entget enl)))
- pt2 (cdr (assoc 11 (entget enl)))
- mid_pt (mapcar '(lambda (x y) (/ (+ x y) 2)) pt2 pt1)
- ang (angle pt1 pt2)
- )
- (if (and (> ang (* 0.5 pi)) (<= ang (* pi 1.5)))
- (setq ang (- ang pi))
- )
- (emk_t (cdr (assoc 8 (entget ent)))
- '(0 0 0)
- (polar mid_pt (+ ang (* 0.5 pi)) 100)
- (cdr (assoc 1 (entget ent)))
- ang
- 1
- 0
- (cdr (assoc 40 (entget ent)))
- (cdr (assoc 41 (entget ent)))
- (cdr (assoc 7 (entget ent)))
- )
- )
- )
- )
- )
- ))
- (princ)
- )
|