将点取或框选的数据(应该仅指文本吧),写到TXT文件或者数组中,再往EXCEL中输入。 给你提供个将cad文本写入TXT的参考例子: (DEFUN c:wenb() (princ "\n文本转换程序") (setq scal (getvar "dimscale")) (setq filename "d:/wenb/wenb.txt") ;(initget 1) (setq fname (getstring "\n请给出结果文件名<d:/wenb.txt>")) (if (= "" fname) (setq fname filename));缺省 (setq filename fname) (initget "New Add") (setq ma (getkword"\nN重新建立文件/<A添加到结果文件>:")) (princ (strcat "\n 数据写入文件" filename "中")) (setq row 0 g "\"" ga "\",\"") (cond ((= ma "New") (setq fff (open filename "w")) ) ((= ma "Add") (setq fff (open filename "a")) ) (T (setq fff (open filename "a")) ) ) ;(setq fff (open filename "a")) (if fff (progn (initget 1) (setq pbase (getpoint "\n给出框取文本基准点")) (setq xbase (car pbase)) (setq ybase (cadr pbase)) (prompt "\n框取要提取的文本") (setq sset (ssget)) (setq ssl (sslength sset) nsset (ssadd)) (while (> ssl 0) (setq temp (ssname sset(setq ssl (1- ssl)))) (setq tj1 (= (cdr (assoc 0 (entget temp))) "TEXT")) (if tj1 (ssadd temp nsset)) ) (setq wzlist (list (list "x999y999 end"))) (setq nssl (sslength nsset) i 0 rmax 1) (PRINC (STRCAT "\n "(ITOA NSSL) " 个文本已找到")) (princ "\n 正在筛选出文本...") (while (< i nssl) (setq twz t) (setq temp (ssname nsset i)) (setq i (1+ i)) (setq wz (cdr (assoc 1 (entget temp)))) (setq rline wz ) (write-line rline fff) ) (close fff) (princ) ) (princ (strcat "不能打开文件" filename)) ) )
|