- (defun c:tt ()
- (vl-load-com)
- (or path
- (setq path "C:\\Documents and Settings\\whr\\桌面\\")
- )
- (setq ffn (getfiled "输出文件名" path "txt" 1)
- path (strcat (vl-filename-directory ffn) "\\")
- )
- (princ "\n选择多段线: ")
- (if (and (setq ss (ssget '((0 . "lw*")))) ffn)
- (progn
- (setq i 0)
- (setvar "pdmode" 33)
- (setq ff (open ffn "w"))
- (write-line (strcat "序号\tX坐标\tY坐标") ff)
- (repeat (sslength ss)
- (setq s1 (ssname ss i)
- nn 1
- )
- (foreach pp (entget s1)
- (if (= (car pp) 10)
- (progn
- (setq p (trans (cdr pp) 0 1)
- x (rtos (car p) 2 3) ;x坐标
- y (rtos (cadr p) 2 3) ;y坐标
- tx (strcat (itoa nn) "\t" x "\t" y)
- nn (1+ nn)
- )
- (write-line tx ff)
- )
- )
- )
- (setq i (1+ i))
- )
- (close ff)
- )
- )
- (princ)
- )
|