冲模设计好用的小工具------将文本转换为全大写或全小写
www.dimcax.com
冲模设计好用的小工具------将文本转换为全大写或全小写
(defun c:ul ()
(setvar "cmdecho" 0)
(terpri)
(setq r2d (/ 360 pi 2))
(setq ss1 (ssget)
ans (getstring "修改文本为[u]所有大写字母或[l]所有小写字母<u>? ")
idx -1
sl1 (sslength ss1)
sl1 (- sl1 1))
(if (= ans "l") (setq ans "l"))
(if (= ans "l") (lower) (upper))
)
(defun lower ()
(setq idx (+ 1 idx))
(if (>= idx sl1) (stop))
(setq b$ (ssname ss1 idx))
(print sl1)
(print idx)
(print b$)
(setq c$ (entget b$)
txts (assoc '1. c$)
tht (assoc '40. c$)
ht (cdr tht)
rot (assoc '50. c$)
roa (cdr rot)
roa (* roa r2d)
f$ (cdr txts)
g$ (substr f$ 1)
g$ (strcase g$ 1))
(command ".change" b$ "" "" "" "" "" "" g$)
(if (< idx sl1) (lower) (stop))
)
(defun upper ()
(setq idx (+ 1 idx))
(if (>= idx sl1) (stop))
(setq b$ (ssname ss1 idx))
(if (>= idx sl1) (stop))
(setq c$ (entget b$)
txts (assoc '1. c$)
tht (assoc '40. c$)
ht (cdr tht)
rot (assoc '50. c$)
roa (cdr rot)
roa (* roa r2d)
f$ (cdr txts)
g$ (substr f$ 1)
g$ (strcase g$))
(command ".change" b$ "" "" "" "" "" "" g$)
(if (< idx sl1) (upper) (stop))
)
(defun stop ()
(terpri)
(setvar "cmdecho" 1)
)
不行,没反应
很想学学