- ;;数字文本补零函数
- ;;code by edata@mjtd
- ;;2014-6-10
- (defun sk_str_addzero(str add_num)
- (if(and str add_num (= (type str)'STR)(> add_num 0)(= (type add_num)'INT))
- (if(< (strlen str) add_num)
- (repeat (- add_num (strlen str))
- (setq str(strcat "0" str))
- )
- str
- )
- )
- )
- ;;选择数字文本补零
- (defun c:tt(/ en ss obj str)
- (prompt "\n请选择数值文本.多行文字不要带格式.否则无效.")
- (if(setq ss (ssget '((1 . "*#*"))))
- (while (setq en(ssname ss 0))
- (setq obj (vlax-ename->vla-object en)
- str (vla-get-textstring obj))
- (vla-put-textstring obj (sk_str_addzero str 5))
- (setq ss(ssdel en ss))
- )
- )
- )
|