- (defun c:TT (/ P1 P2 SS I TXT TXT1 E)
- (SETQ P1 (GETPOINT "\n选择第一点")
- p2 (getcorner p1 "\n选择第二点")
- )
- (setq ss (ssget "c" P1 P2 '((0 . "*TEXT"))))
- (IF (NOT SS)
- (VL-EXIT-WITH-VALUE 0)
- )
- (setvar 'QAFLAGS 1)
- (command "explode" ss "")
- (setvar 'QAFLAGS 0)
- (setq ss (ssget "c" P1 P2 '((0 . "*TEXT"))))
- (SETQ I 0)
- (IF (NOT SS)
- (VL-EXIT-WITH-VALUE 0)
- )
- (repeat (sslength ss)
- (setq e (SSNAME SS I)
- txt (cdr (ASSOC 1 (entget e)))
- txt1 txt
- i (1+ I)
- )
- (WHILE (= "0" (SUBSTR TXT1 1 1))
- (SETQ TXT1 (vl-string-left-trim "0" TXT1))
- )
- (ENTMOD (SUBST (CONS 1 TXT1) (CONS 1 TXT) (ENTGET E)))
- )
- (PRINC)
- )
应该问题不大了 |