考虑以下因素:
- (defun c:ptx ( / d f i n s x z )
- (if (and (setq s (ssget '((0 . "POINT,LWPOLYLINE"))))
- (setq f (getfiled "" "" "txt" 1))
- )
- (if (setq d (open f "w"))
- (progn
- (repeat (setq i (sslength s))
- (setq x (entget (ssname s (setq i (1- i))))
- z (cdr (assoc 038 x))
- n (cdr (assoc 210 x))
- )
- (if (= "POINT" (cdr (assoc 0 x)))
- (write-line (pnt2str (trans (cdr (assoc 10 x)) 0 1)) d)
- (foreach g x
- (if (= 10 (car g))
- (write-line (pnt2str (trans (list (cadr g) (caddr g) z) n 1)) d)
- )
- )
- )
- )
- (close d)
- )
- (princ "\nUnable to open the file for writing.")
- )
- )
- (princ)
- )
- (defun pnt2str ( p )
- (if (cdr p) (strcat (rtos (car p) 2) "," (pnt2str (cdr p))) (rtos (car p) 2))
- )
- (princ)
|