[转帖]如何使用?
有位老鸟帮我做了一个程序:
下面的程序已测试通过,供参考:
(defun c:dxcd(/ )<BR> (setq ss(ssget "x" '((0 . "MTEXT"))))<BR> (setq sn(sslength ss))<BR> (setq dxtab nil i 0)<BR> <BR> (while(< i sn)<BR> (setq si(ssname ss i)<BR> str(cdr(assoc 1 (entget si)))<BR> )<BR> (setq pos nil)<BR> (if(< (strlen str) 15)<BR> (setq pos(vl-string-position (ascii "/") str))<BR> )<BR> (if pos<BR> (progn<BR> (setq xx(substr str 1 pos) cd(substr str (+ pos 2)) cd(atof cd))<BR> (setq dxlst(assoc xx dxtab))<BR> (if dxlst<BR> (progn<BR> (setq cd(+ (cdr dxlst) cd))<BR> (subst (cons xx cd) dxlst dxtab)<BR> )<BR> (setq dxtab(append dxtab (list(cons xx cd))))<BR> )<BR> )<BR> )<BR> (setq i(1+ i))<BR> )<BR> (princ "\n统计结果")<BR> (princ "\n-----------------------")<BR> (princ "\n导线型号 导线长度")<BR> (princ "\n-----------------------")<BR> <BR> (setq i 0)<BR> (while(< i (length dxtab))<BR> (setq dxlst(nth i dxtab))<BR> (princ (strcat "\n" (car dxlst) " " (rtos (cdr dxlst) 2 2)))<BR> (setq i(1+ i))<BR> )<BR> (princ "\n-----------------------")<BR> (princ) <BR>)<BR> <BR>下面是运行结果:<BR>Command: dxcd
统计结果<BR>-----------------------<BR>导线型号 导线长度<BR>-----------------------<BR>LGJ-95 690.5<BR>BLV-35 2873<BR>BLV-50 1482.5<BR>BLV-70 252<BR>LGJ-70 125<BR>LGJ-120 92<BR>-----------------------<BR>但我不知怎么用,望能帮忙
页:
[1]