英文字母大小写转换
下来看看 这个应该不难吧? 下来看看 这个应该不难吧? (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 谢谢!很好用的小程序 谢谢楼主的分享!很有意思 试试看了
页:
[1]