- ;;; 标注好的坐标输出TXT格式:
- ;;; 输出样式:
- ;;; X值 Y值
- ;;; 1, 87753.815, 52860.248
- ;;; 2, 2887765.655, 452850.981
- (defun c:tt ( / ss n info ent txt pt t_h tmp tmp1 tmp2 f_n f_op)
- (setq ss (ssget '((0 . "TEXT") (1 . "X=*,x=*"))))
- (setq n 0)
- (setq info '())
- (repeat (if ss (sslength ss) 0)
- (setq ent (entget (ssname ss n))
- txt (cdr (assoc 1 ent))
- pt (cdr (assoc 10 ent))
- t_h (cdr (assoc 40 ent))
- )
- (setq info (append info (list (list pt txt t_h))))
- (setq n (1+ n))
- )
- ; (command "_.zoom" "_e")
- (setq info (mapcar '(lambda(x)
- (progn (setq tmp (car x))
- (setq tmp1 (mapcar '(lambda(y) (- y (caddr x))) tmp)
- tmp2 (mapcar '(lambda(y) (+ y (caddr x))) tmp))
- (and (setq ss_tmp (ssget "c" tmp1 tmp2 '((0 . "TEXT") (1 . "Y=*,y=*"))))
- (setq tmp (cdr (assoc 1 (entget (ssname ss_tmp 0)))))
- (setq x (list (car x) (cadr x) tmp))
- )
- x)) info))
- (setq info (vl-sort info '(lambda (x y) (< (caar x) (caar y)))))
- (setq info (vl-sort info '(lambda (x y) (< (cadar x) (cadar y)))))
- (setq f_n (getvar "DWGname")
- f_n (strcat (substr f_n 1 (- (strlen f_n) 4)) ".txt")
- f_n (strcat (getvar "DWGPREFIX") f_n)
- )
- (setq n 0)
- (setq f_op (open f_n "w"))
- (princ " X 值 Y 值\n" f_op)
- (mapcar '(lambda(x)
- (princ (strcat (itoa (setq n (1+ n))) ", ") f_op)
- (princ (substr (cadr x) 3) f_op)
- (princ ", " f_op)
- (princ (substr (caddr x) 3) f_op)
- (princ "\n" f_op)
- ) info)
- (close f_op)
- (princ)
- )
|