(defun c:tqzb (/) (setq cm (getvar "cmdecho")) (setvar "cmdecho" 0) (if (setq wjm (getfiled "请指定2113要保存的坐标5261文件4102" "e:\\" "txt" 1)) (if (setq ssa (ssget '((0 . "LWPOLYLINE")))) (progn (setq fff (open wjm "w") n (sslength ssa) i 0 no 0 ) (repeat n (setq dxf (entget (ssname ssa i)) i (1+ i) ptb (mapcar 'cdr (vl-remove-if-not '(lambda(x)(= (car x) 10)) dxf)) ptb (mapcar '(lambda(x)(trans x 0 1)) ptb) ) (foreach pt ptb (setq no (1+ no)) (write-line (strcat (itoa no) "," (rtos (car pt) 2 2) "," (rtos (cadr pt) 2 2) "," ) fff ) ) ) (close fff) (princ (strcat "\n坐标已存入1653\"" wjm "\"中")) ) ) ) (setvar "cmdecho" cm) (princ))更多追问追答追问我想要输出的格式为“123.12,145.23”这样,即不要前面的序号以及最后的逗号,望高手改下你的程序,追答(defun c:tqzb (/) (setq cm (getvar "cmdecho")) (setvar "cmdecho" 0) (if (setq wjm (getfiled "请指定要保存的坐标文件" "e:\\" "txt" 1)) (if (setq ssa (ssget '((0 . "LWPOLYLINE")))) (progn (setq fff (open wjm "w") n (sslength ssa) i 0 no 0 ) (repeat n (setq dxf (entget (ssname ssa i)) i (1+ i) ptb (mapcar 'cdr (vl-remove-if-not '(lambda(x)(= (car x) 10)) dxf)) ptb (mapcar '(lambda(x)(trans x 0 1)) ptb) ) (foreach pt ptb (setq no (1+ no)) ;(write-line (strcat (itoa no) "," (rtos (car pt) 2 2) "," (rtos (cadr pt) 2 2) "," ) fff ) ) ) (close fff) (princ (strcat "\n坐标已存入\"" wjm "\"中")) ) ) ) (setvar "cmdecho" cm) (princ))追问老大,还不行啊,麻烦你再看看,我对照了一下程序,貌似没什么变化啊追答给你这个: (defun c:tqzb (/) (setq cm (getvar "cmdecho")) (setvar "cmdecho" 0) (if (setq wjm (getfiled "请指定要保存的坐标文件" "e:\\" "txt" 1)) (if (setq ssa (ssget '((0 . "LWPOLYLINE")))) (progn (setq fff (open wjm "w") n (sslength ssa) i 0 no 0 ) (repeat n (setq dxf (entget (ssname ssa i)) i (1+ i) ptb (mapcar 'cdr (vl-remove-if-not '(lambda(x)(= (car x) 10)) dxf)) ptb (mapcar '(lambda(x)(trans x 0 1)) ptb) ) (foreach pt ptb (setq no (1+ no)) (write-line (strcat ;(itoa no) "," (rtos (car pt) 2 2) "," (rtos (cadr pt) 2 2) ) fff ) ) ) (close fff) (princ (strcat "\n坐标已存入\"" wjm "\"中")) ) ) ) (setvar "cmdecho" cm) (princ)),源程序呢?www.mh456.com防采集。
我有提取CAD里的坐标到Excel表格的软件,可以永久使用的,你要吗?更多追问追答追问是否是批量选中提取的?我目前使用ZBBZ但是都需要一个一个拉坐标追答是批量提取坐标的,很快很方便的!你要吗?追问发给我,快追答怎样联系你?追问422087312 企鹅
内容来自www.mh456.com请勿采集。