- ;1尺寸后加加前通孔
- (defun C:TT (/ E N OBJ SS TEXTOVERRIDE)
- (while (and (setvar "nomutt" 1)
- (princ "\n 选择尺寸,切换前缀φ")
- (setq ss (ssget ":S" '((0 . "*DIMENSION"))))
- (setvar "nomutt" 0)
- )
- (repeat (setq n (sslength ss))
- (setq e (ssname ss (setq n (1- n))))
- (setq obj (vlax-ename->vla-object e))
- (setq TextOverride (vlax-get obj 'TextOverride))
- (if (= "" TextOverride)
- (if (= (vla-get-TextSuffix obj) "(通孔)")
- (vla-put-TextSuffix obj "")
- (vla-put-TextSuffix obj "(通孔)")
- )
- (if (or (wcmatch TextOverride "*(通孔)")
- (wcmatch TextOverride "*(通孔)")
- (wcmatch TextOverride "*(通孔)")
- )
- (progn
- (while (VL-STRING-SEARCH "(通孔)" TextOverride)
- (setq TextOverride
- (VL-STRING-SUBST "" "(通孔)" TextOverride)
- )
- )
- (while (VL-STRING-SEARCH "(通孔)" TextOverride)
- (setq TextOverride
- (VL-STRING-SUBST "" "(通孔)" TextOverride)
- )
- )
- (while (VL-STRING-SEARCH "(通孔)" TextOverride)
- (setq TextOverride
- (VL-STRING-SUBST "" "(通孔)" TextOverride)
- )
- )
- (vla-put-TextOverride obj TextOverride)
- )
- (vla-put-TextOverride obj (strcat "(通孔)" TextOverride))
- )
- )
- )
- )
- (setvar "nomutt" 0) ;空选时执行
- )
|