本帖最后由 USER2128 于 2012-11-20 20:59 编辑
我还是上传吧!- (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 f_n (getvar "DWGname")
- f_n (strcat (substr f_n 1 (- (strlen f_n) 4)) ".txt")
- f_n (strcat (getvar "DWGPREFIX") f_n)
- )
- (setq f_op (open f_n "w"))
- (princ " X 值 Y 值\n" f_op)
- (mapcar '(lambda(x)
- (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)
- )
|