[求助]大小写转换的LSP源码
<p>哪位能提供大小写英文字母转换的LSP源码供学习啊,不胜感谢</p><p>要求TEXT和MTEXT都能转换</p> <p>以前見過有 你在论談找一下</p> (Defun c:dx ( / case)(command "redraw")
(setq fil (ssget))
(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) 太强了! 非标好的资料,谢谢楼主分享的。 感觉这个自己平时不是太用得到呢 You might find tcase.lsp in express tool folder for learning purpose ^^ 下载过类似的,看看这个
页:
[1]