这将适用于CSV文件。。。(Excel文件的另一种格式)-它是另一个线程中代码的较短版本。
试一试,看看你的想法。
- (if (and (setq file (getfiled "Select Excel File" "C:\" "csv" 9)
- ss (ssget "X" (list (cons 0 "INSERT") (cons 66 1)
- (if (getvar "CTAB") (cons 410 (getvar "CTAB"))
- (cons 67 (- 1 (getvar "TILEMODE"))))))))
- (progn
- (setq file (open file "a") ss (mapcar 'entnext (mapcar 'cadr (ssnamex ss))))
- (foreach e ss
- (while (not (eq "SEQEND" (cdadr (entget e))))
- (setq att (strcat (cdr (assoc 2 (entget e))) (chr 44) (cdr (assoc 1 (entget e))))
- attLst (cons att attLst) e (entnext e))))
- (alert (vl-princ-to-string attLst))
- (mapcar '(lambda (x) (write-line x file)) attLst)
- (close file))
- (princ "\n<!> No File Selected or No Attributed Blocks Found <!>"))
- (princ))
|