有两个方法,
-
选择图形,右键,快速选择,文字,输入文字内容,就会把相同的文字全部找出来了。
-
使用autoLISP查找相同的文字。得到文字后,右键,属性,里面看文字数量即可。(高版本的AutoCAD里面有快捷面板,可以直接看数量)
(defun c:TT2 ( / #kw #k2 )
(if (null vlax-dump-object) (vl-load-com) )
(initget "T") (setq #kw (entsel "n请选择文字或输入文字(T)[输入文字(T)]: <选择文字> "))
(cond
((= (type #kw) 'LIST)
(if (= (vla-get-objectname (setq #kw (vlax-ename->vla-object (car #kw)))) "AcDbText")
(setq #kw (vla-get-textstring #kw))
(progn
(setq #kw nil) (princ "n错误的对象,请选择单行文字对象!")
)
)
)
((member #kw (list "t" "T"))
(if (= (setq #kw (getstring "n请输入要选取的文字: ")) "")
(progn
(setq #kw nil) (princ "n未输入文字,程序退出!")
)
)
)
)
(if #kw (princ (strcat "n框选包含文字 < " #kw " >的对象")) )
(if (and #kw (setq #kw (ssget (list (cons 0 "TEXT") (cons 1 #kw)))))
(progn
(initget "V C S E") (setq #k2 (getkword "n选择文字或[移动(V)/复制(C)/删除(E)]: <选择(S)> "))
(if (null #k2)
(sssetfirst nil #kw)
(cond
((member #k2 (list "v" "V")) (command "_.Move" #kw "" pause) )
((member #k2 (list "c" "C")) (command "_.Copy" #kw "" pause) )
((member #k2 (list "e" "E")) (command "_.Erase" #kw "") )
((member #k2 (list "s" "S")) (sssetfirst nil #kw) )
)
)
)
(princ "n未定义文字或未选择对象!")
)
(prin1)
)
(prompt "n《TT2》框选文字")
(prin1)