- (Defun c:xdx ( / case)
- (command "redraw")
- (princ "\n修改文字的大小写,请选择文字")
- (setq fil (ssget'((0 . "TEXT,MTEXT"))))
- (setq case (getint "\n改成[小写(1)] <直接回车为大写>:"))
- (setq len (sslength fil))
- (setq n 0)
- (while (<= n (- len 1))
- (progn
- (setq e (ssname fil n))
- (cond
- ((= "TEXT" (cdr (assoc 0 (setq ed (entget e)))))
- (progn
-
- (setq ostr (cdr (assoc 1 ed)))
- (setq nstr (strcase ostr case))
- (setq ed (subst (cons 1 nstr) (assoc 1 ed) ed))
- (setq n (+ 1 n))
- (entmod ed)
- ))
- ((= "MTEXT" (cdr (assoc 0 (setq ed (entget e)))))
- (progn
-
- (setq ostr (cdr (assoc 1 ed)))
- (setq nstr (strcase ostr case))
- (setq lenstr (strlen nstr))
- (setq m 1)
- (while (< m lenstr)
- (if (= "\\p" (substr nstr m 2))
-
- (setq nstr (strcat (substr nstr 1 m) "\P" (substr nstr (+ 2 m))))
- ;(setq m (+ 1 m))
- )
- (setq m (+ 1 m))
- )
- (setq ed (subst (cons 1 nstr) (assoc 1 ed) ed))
- (setq n (+ 1 n))
- (entmod ed)
- ))
- (T (setq n (+ 1 n)))
- )
- )
- )
- (princ)
- );end defun
|