标注一轴,表示直径时前面要加φ,修改标注方式很麻烦,可以集中在“处理标注”的工具中
- ;;11 尺寸前加前缀φ
- (defun A-DIMENSION-Pre (/ 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-TextPrefix obj) "%%C")
- (vla-put-TextPrefix obj "")
- (vla-put-TextPrefix obj "%%C")
- )
- (if (or (wcmatch TextOverride "*%%C*")
- (wcmatch TextOverride "*%%c*")
- (wcmatch TextOverride "*φ*")
- )
- (progn
- (while (VL-STRING-SEARCH "%%C" TextOverride)
- (setq TextOverride
- (VL-STRING-SUBST "" "%%C" TextOverride)
- )
- )
- (while (VL-STRING-SEARCH "%%c" TextOverride)
- (setq TextOverride
- (VL-STRING-SUBST "" "%%c" TextOverride)
- )
- )
- (while (VL-STRING-SEARCH "φ" TextOverride)
- (setq TextOverride
- (VL-STRING-SUBST "" "φ" TextOverride)
- )
- )
- (vla-put-TextOverride obj TextOverride)
- )
- (vla-put-TextOverride obj (strcat "%%C" TextOverride))
- )
- )
- )
- )
- (setvar "nomutt" 0) ;空选时执行
- )
|