有没有把西文的括号转换成中文括号的LISP程序啊?
工作中经常遇到西文括号,有时为了美观,想改成中文括号,查找替换有时太费时间,想进一步快点。有没有把西文的括号转换成中文括号的LISP程序啊?论坛上搜索了很久,也没发现。 利用查找替换就可以,不用编lsp。非要编的话在坛子里找一个查找替换的代码改改就可以了springwillow 发表于 2012-5-28 09:16 static/image/common/back.gif
利用查找替换就可以,不用编lsp。非要编的话在坛子里找一个查找替换的代码改改就可以了
虽然觉得查找替换也很方便,但就是想能再快的。。时间就是金钱啊 zhengchuan 发表于 2012-5-28 09:21 static/image/common/back.gif
虽然觉得查找替换也很方便,但就是想能再快的。。时间就是金钱啊
帮你改了一个,不知道合不合胃口。(defun C:CHTEXT (/ p l n e os as ns st s nsl osl sl si chf chm cont)
(setq chm 0 p (ssget)) ; Select objects
(if p
(progn ; If any objects selected
(setq cont t)
(while cont
(setq osl (strlen (setq os "(")))
(if (= osl 0)
(princ "Null input invalid")
(setq cont nil)
)
)
(setq nsl (strlen (setq ns "(")))
(setq l 0 n (sslength p))
(while (< l n)
(if (OR (= "MTEXT"
(cdr (assoc 0 (setq e (entget (ssname p l))))))
(= "TEXT"
(cdr (assoc 0 (setq e (entget (ssname p l)))))))
(progn
(setq chf nil si 1)
(setq s (cdr (setq as (assoc 1 e))))
(while (= osl (setq sl (strlen
(setq st (substr s si osl)))))
(if (= st os)
(progn
(setq s (strcat (substr s 1 (1- si)) ns
(substr s (+ si osl))))
(setq chf t)
(setq si (+ si nsl))
)
(setq si (1+ si))
)
)
(if chf (progn
(setq e (subst (cons 1 s) as e))
(entmod e)
(setq chm (1+ chm))
))
)
)
(setq l (1+ l))
)
(setq cont t)
(while cont
(setq osl (strlen (setq os ")")))
(if (= osl 0)
(princ "Null input invalid")
(setq cont nil)
)
)
(setq nsl (strlen (setq ns ")")))
(setq l 0 n (sslength p))
(while (< l n)
(if (OR (= "MTEXT"
(cdr (assoc 0 (setq e (entget (ssname p l))))))
(= "TEXT"
(cdr (assoc 0 (setq e (entget (ssname p l)))))))
(progn
(setq chf nil si 1)
(setq s (cdr (setq as (assoc 1 e))))
(while (= osl (setq sl (strlen
(setq st (substr s si osl)))))
(if (= st os)
(progn
(setq s (strcat (substr s 1 (1- si)) ns
(substr s (+ si osl))))
(setq chf t)
(setq si (+ si nsl))
)
(setq si (1+ si))
)
)
(if chf (progn
(setq e (subst (cons 1 s) as e))
(entmod e) (setq chm (1+ chm))
))
)
)
(setq l (1+ l))
)
)
)
(princ "共修改了 ") ; Print total lines changed
(princ chm)
(princ " 个西文括号.")
(terpri)
) springwillow 发表于 2012-5-28 09:58 static/image/common/back.gif
帮你改了一个,不知道合不合胃口。
谢谢!很合口味 springwillow 发表于 2012-5-28 09:58 static/image/common/back.gif
帮你改了一个,不知道合不合胃口。
感谢分享。。。收藏了。。 不太会,学习了! 感谢分享。。。收藏了。。!!!
感谢分享。。。收藏了。。!!! 天正标注之类的能改吗?
页:
[1]