sxh_why 发表于 2010-2-6 14:37:00

<p>发个我的最经典的心得,能不能帮到爬楼的弟兄,能不能领悟,全靠缘分。高手就别看了。</p><p>Terry Miller 写了一个超级经典的批处理命令,藏在他一堆乱哄哄的程序里,排在一个很不起眼的位置。</p><p></p><p></p><p></p>

hhh454 发表于 2010-2-21 10:06:00

<p>恭祝大家虎年行大运,财源滚滚来,大吉大利,万事如意,身体健康,祝明经好上加好,传一个网上的程序,程序说明:</p><p>&nbsp;&nbsp;&nbsp; 此软件能解决CAD文字编辑、排版的不足,能轻易实现统一CAD文字字高、用水平方式和垂直方式对CAD文字进行排版处理。</p><p><br/>使用方法</p><p>&nbsp;&nbsp;&nbsp; 软件加载:打开菜单:工具----加载应用程序,即成功加载程序了。程序加载后,会暗示命令帮助提示</p><p>*********************************************************<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 文字排版命令程序命令表<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QA........以垂直方式对齐排列各文字行<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QW........以水平方式对齐排列各文字行<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QS........统一字高</p><p>&nbsp;里面是一对乱码,可以用。</p><p>&nbsp;</p>

dkj0322 发表于 2010-9-9 14:16:00

<p>很精彩,本人是新手,受益匪浅</p>
<p>&nbsp;</p>

自贡黄明儒 发表于 2010-10-24 22:18:00

文字递增

本帖最后由 作者 于 2010-10-28 18:26:47 编辑 <br /><br /> <p>;;;<font face="Verdana">文字递增</font></p>
<p>;;;根据caoyin的刷子函数写成如下函数;空格键不能中断</p>
<p><font face="Verdana">;;;;;;;;;;;;<br/>;;;功能,如果是文字末尾不是数,则加1.如果是数,取出来作为基数HH:Textnum<br/>(defun textIncrease ( / BOOL E ENT HH:TEXTNUM HH:TEXTPRE I OB1 OBA OBALENGTH OBN OBT OTXT PTN)<br/>&nbsp; (lt:error-init (list nil 0 nil))<br/>;;;取得文字<br/>&nbsp; (setq bool T)<br/>&nbsp; (while bool<br/>&nbsp;&nbsp;&nbsp; (setq ob1 (entsel "\n选择要修改的任何文本:"))<br/>&nbsp;&nbsp;&nbsp; (SETQ obn (car ob1)&nbsp;&nbsp;&nbsp;;图元<br/>&nbsp;&nbsp; ptn (car (cdr ob1))&nbsp;&nbsp;;拾取点<br/>&nbsp;&nbsp;&nbsp; ) ;_ 结束SETQ<br/>&nbsp;&nbsp;&nbsp; (setq obt (car (nentselp ptn)))<br/>&nbsp;&nbsp;&nbsp; (setq oba (cdr (assoc 0 (entget obt))))<br/>&nbsp;&nbsp;&nbsp; (if&nbsp;(or (= oba "TEXT")<br/>&nbsp;&nbsp;&nbsp;&nbsp; (= oba "MTEXT")<br/>&nbsp;&nbsp;&nbsp;&nbsp; (= oba "ATTRIB")<br/>&nbsp;&nbsp;&nbsp;&nbsp; (= oba "ATTDEF")<br/>&nbsp;) ;_ 结束or<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq bool nil)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (princ "\n必须选择文字,重来:")<br/>&nbsp;&nbsp;&nbsp; ) ;_ 结束if<br/>&nbsp; )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;end while</font></p>
<p><font face="Verdana">&nbsp; (setq ent (entget obt))<br/>&nbsp; (if (= oba "ATTDEF")<br/>&nbsp;&nbsp;&nbsp; (setq otxt (cdr (assoc 2 ent)))<br/>&nbsp;&nbsp;&nbsp; (setq otxt (cdr (assoc 1 ent)))<br/>&nbsp; )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; end if</font></p>
<p><font face="Verdana">&nbsp; (if (obaEndIsNumber otxt)<br/>&nbsp;&nbsp;&nbsp; (progn<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq bool T i 0) <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq obaLength (strlen otxt))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (while bool<br/>&nbsp;(setq e (ascii (substr otxt obaLength 1)))&nbsp;<br/>&nbsp;(if (or (and (&gt; e 47) (&lt; e 58)))<br/>&nbsp;&nbsp; (progn <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq obaLength (1- obaLength))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq i (1+ i))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp; (setq bool nil)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;) ;_ 结束if<br/>&nbsp;(if (= i (strlen otxt)) (setq bool nil))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) ;_ 结束while<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq obaLength (- (strlen otxt) i));前缀长度<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq HH:Textpre (substr otxt 1 obaLength))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq HH:Textnum (substr otxt (+ 1 obaLength) i))<br/>&nbsp;&nbsp;&nbsp; ) ;_ 结束progn<br/>&nbsp;&nbsp;&nbsp; (progn<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq HH:Textpre otxt)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq HH:Textnum "1")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq otxt (strcat otxt "1"))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (= oba "ATTDEF")<br/>&nbsp;(progn<br/>&nbsp;&nbsp; (entmod (subst (cons 2 otxt) (assoc 2 ent) ent))<br/>&nbsp;&nbsp; (entupd obn)<br/>&nbsp;) ;_ 结束progn<br/>&nbsp;(progn<br/>&nbsp;&nbsp; (entmod (subst (cons 1 otxt) (assoc 1 ent) ent))<br/>&nbsp;&nbsp; (entupd obn)<br/>&nbsp;) ;_ 结束progn<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) ;_ 结束if<br/>&nbsp;&nbsp;&nbsp; ) ;_ 结束progn<br/>&nbsp; ) ;_ 结束if</font></p>
<p><font face="Verdana">&nbsp; (lt:match<br/>&nbsp;&nbsp;&nbsp; (cadr ob1)<br/>&nbsp;&nbsp;&nbsp; '(2 2)<br/>&nbsp;&nbsp;&nbsp; (list "\n选择要改变的文字: "<br/>&nbsp;&nbsp; '((0 . "*TEXT,INSERT"))<br/>&nbsp;&nbsp;&nbsp; ) ;_ 结束list<br/>&nbsp;&nbsp;&nbsp; '(lambda (x / ent)<br/>;;;(setq x (car (entsel)))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq ent (entget x))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq HH:Textnum (itoa (1+ (atoi HH:Textnum))))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq otxt (strcat HH:Textpre HH:Textnum))<br/>;;;获得块名,之后用entnext访问它的名成元<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (= "INSERT" (cdr (assoc 0 ent)))<br/>&nbsp; (progn<br/>&nbsp;&nbsp;&nbsp; (setq firn (ENTNEXT (CDR (ASSOC -1 ENT))))<br/>&nbsp;&nbsp;&nbsp; (if firn (setq bool T))<br/>&nbsp;&nbsp;&nbsp; (while bool&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (SETQ ENT (ENTGET firn))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (or (= (CDR (ASSOC 0 ent)) "TEXT")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (= (CDR (ASSOC 0 ent)) "MTEXT")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (= (CDR (ASSOC 0 ent)) "ATTRIB")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp; ) ;_ end of or<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (progn (entmod (subst (cons 1 otxt) (assoc 1 ent) ent))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq bool nil)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) ;_ end of progn<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (progn (if (= (cdr (assoc 0 ent)) "ATTDEF")<br/>&nbsp;&nbsp;&nbsp;(entmod (subst (cons 2 otxt) (assoc 2 ent) ent))<br/>&nbsp;&nbsp;&nbsp;(setq bool nil)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) ;_ end of if<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) ;_ end of progn<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) ;_ end of if<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (entupd firn)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (entupd x)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq firn (entnext firn))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if firn<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq bool nil)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) ;_ end of if<br/>&nbsp;&nbsp;&nbsp; ) ;_ end of while<br/>&nbsp; ) ;_ end of progn<br/>&nbsp; (entmod (subst (cons 1 otxt) (assoc 1 ent) ent))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) ;_ end of if</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp;&nbsp; ) ;_ 结束lambda<br/>&nbsp; ) ;_ 结束lt:match<br/>&nbsp; (lt:error-restore)</font></p>
<p><font face="Verdana">) ;_ 结束defun</font></p>
<p><font face="Verdana"></font>&nbsp;</p>
<p><font face="Verdana"><br/>;;;所取字符串末尾是不是数,返回真假<br/>(defun obaEndIsNumber (otxt / E OBALENGTH)<br/>&nbsp; (setq obaLength (strlen otxt))<br/>&nbsp; (setq e (ascii (substr otxt obaLength 1)))<br/>&nbsp; (and (&gt; e 47) (&lt; e 58))<br/>) ;_ 结束defun<br/>;;; 结束defun obaEndIsNumber</font></p>

cable2004 发表于 2010-10-31 16:18:00

<p>这里是CAD知识的海洋,是中国工程的的CAD之家。</p>

daiguafan 发表于 2010-11-16 08:37:00

绝对好贴<div>顶下,学习中</div>

xiaxiang 发表于 2010-12-14 14:26:02

发现了,顶起来,大家来学习

xjf 发表于 2010-12-19 22:25:51

   经典贴
,学习中

gzbccy 发表于 2010-12-20 19:33:53

我来的太晚了,发现这边的高手真是多啊

sean_huang88 发表于 2011-1-19 08:44:43

happy new year
页: 1 2 3 4 5 6 7 8 9 [10] 11 12 13 14 15
查看完整版本: 【分享明经——发程序、拜新年专贴】