文本统计lisp程序
[*](defun c:wbtj (/ LST1 N E S WB SSlst2
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif lst_new shuz lst lst11lst12 heightp1
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif WBJULI
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif )
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif(setqss (ssget '((0 . "TEXT")))
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gifN0
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif(REPEAT (SSLENGTH SS)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif (SETQ E (SSNAME SS N)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif S (ENTGET E)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif WB (CDR (ASSOC 1 S))
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif height (CDR (ASSOC 40 s))
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif LST1 (CONS WB LST1)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif )
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif (SETQ N (1+ N))
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif(while (> (LENGTH LST1) 0)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif (IF(NOT (MEMBER (NTH 0 LST1) LST2))
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif (progn
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif(SETQ LST2 (append LST2 (list (strcat (NTH 0 LST1) "=")))
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif lst_new (vl-remove (NTH 0 LST1) LST1)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif shuz (itoa (- (LENGTH LST1) (length lst_new)))
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif lst2 (append lst2 (list shuz))
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif lst1 lst_new
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif )
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif )
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif (setq lst(cons lst2 lst)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif lst2 nil
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif )
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif(mapcar '(lambda (x)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif (setq lst11 (cons (strcat (car x) (cadr x)) lst11))
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif )
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif lst
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif(setq lst11 (acad_strlsort lst11))
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif(setq WBJULI (* height 1.4))
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif(setq p1 (getpoint "\n请指定插入点:"))
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif(setq n 0)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif(foreach x lst11
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif (command "text" p1 height "" x)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif (command)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif (setq p1 (list (car p1) (- (cadr p1) WBJULI) (caddr p1)))
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif (setq n (1+ n))
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif(princ)
[*]http://www.cad8.net/source/plugin/imc_colorcode/images/jssc_none.gif)
谢谢楼主的分享了。 再加上统计指定字符就完美了 楼主这个结果会重叠到一起。
多行文字无法统计么,测试了下:
命令:
WBTJ
选择对象: 指定对角点: 找到 0 个
选择对象:参数类型错误: lselsetp nil
命令:
页:
[1]