试试这个。
- (defun c:Test (/ ss f o)
- ;; Tharwat 05.11.2014 ;;
- ;; Export Texts' values to Excel ;;
- (princ "\n << Select Texts to export to Excel : >>")
- (if (and (setq ss (ssget '((0 . "TEXT")
- )
- )
- )
- (setq f (getfiled "Save as :" (getvar 'DWGPREFIX) "csv" 1))
- )
- (progn
- (setq o (open f "w"))
- (write-line
- "X-coordinate of text;Y-coordinate of text;Z-coordinate of text value"
- o
- )
- ((lambda (i / sn p e)
- (while (setq sn (ssname ss (setq i (1+ i))))
- (write-line
- (strcat
- (rtos
- (car (setq p (cdr (assoc 10 (setq e (entget sn))))))
- 2
- )
- ";"
- (rtos (cadr p) 2)
- ";"
- (cdr (assoc 1 e))
- )
- o
- )
- )
- )
- -1
- )
- (close o)
- )
- )
- (princ)
- )
|