TIAO1英文等高调整1.LSP
资源名称:cadlisp1.rar [点击查看]
上传用户:sd555111
上传日期:2014-05-17
资源大小:31k
文件大小:2k
源码类别:
CAD
开发平台:
MathCAD
- ; ====================================
- ; | 中英文等高调整软件(调英文) |
- ; | Ver: 1.0 作者: 尉迟俊岭 |
- ; ====================================
- (defun *error*(st)
- (princ (strcat "Error: " st))
- (princ)
- )
- (defun unt(s$ old$ new$ / osl nsl si st)
- (setq osl (strlen old$)
- nsl (strlen new$)
- si 1)
- (while (= osl (strlen (setq st (substr s$ si osl))))
- (if (= st old$)
- (setq s$ (strcat (substr s$ 1 (1- si)) new$ (substr s$ (+ si osl)))
- si (+ si nsl)
- )
- (setq si (1+ si))
- )
- )
- (setq txt s$)
- )
- (defun C:tiao1( / test test1 test2 ss len n s en1 a ent nn
- txt stxt post)
- (setvar "CMDECHO" 0)
- (setq test T nn 0)
- (while test
- (setq ss (ssadd))
- (setq ss (ssget))
- (if (= nil ss)
- (setq test nil)
- (progn
- (setq len (sslength ss))
- (setq n 1 s 1)
- (while (<= n len)
- (setq en1 (ssname ss (1- n)))
- (setq a (entget en1))
- (if (= "TEXT" (cdr (assoc 0 a)))
- (progn
- (setq txt (cdr (assoc 1 a)))
- (unt txt "%%165" "")
- (unt txt "%%166" "")
- (setq post 1 stxt nil txt1 "" test1 nil test2 1)
- (while (/= stxt "")
- (setq stxt (substr txt post 1))
- (if (and (<= (ascii stxt) 160) (= test2 1))
- (progn
- (setq txt1 (strcat txt1 "%%166"))
- (setq test2 nil)
- (setq test1 1)
- )
- )
- (if (and (> (ascii stxt) 160) (= test1 1))
- (progn
- (setq txt1 (strcat txt1 "%%165"))
- (setq test1 nil)
- (setq test2 1)
- )
- )
- (setq txt1 (strcat txt1 stxt))
- (setq post (1+ post))
- )
- (setq ent (subst (cons 1 txt1) (assoc 1 a) a))
- (entmod ent)
- (setq nn (1+ nn))
- )
- )
- (setq n (1+ n))
- )
- )
- )
- )
- (princ (strcat (itoa nn) " 变化数 !"))
- (princ)
- )