- (defun c:tt ()
- "简易查找文本并亮显"
- (setq tx (getstring "\n输入要查找的文本<右键选取>: "))
- (cond ((and (= tx "")
- (setq s1 (entsel "\n选择标记: "))
- (= (cdr (assoc 0 (entget (car s1)))) "TEXT")
- )
- (redraw (car s1) 3)
- (setq tx (cdr (assoc 1 (entget (car s1)))))
- )
- )
- (if (and tx
- (/= tx "")
- (setq ss (ssget "x"
- (list '(0 . "MTEXT,TEXT") (cons 1 (strcat "*" tx "*")))
- )
- )
- (> (sslength ss) 0)
- (setq p0 (getpoint "\n基点<退出>: "))
- )
- (progn
- (setq i -1)
- (princ (strcat "\n总共找到 " (itoa (sslength ss)) " 处"))
- (sssetfirst ss ss)
- (while (setq s1 (ssname ss (setq i (1+ i))))
- (setq pt (cdr (assoc 10 (entget s1))))
- (command "line" "non" pt "non" p0 "")
- )
- )
- )
- (princ)
- )
|