dengken204 发表于 2008-7-8 17:39:00

[求助]如何简化LISP的“回车”操作?

<div style="FONT-SIZE: 14px;">如何简化LISP的“回车”操作?<br/>如附件所示意的LISP是网上找的,是用来改变文字的图层的。<br/>但是每次使用的时候,选取源文字,再选取目标文字后,目标文字不能马上改变图层,必须等再按一次回车或者空格才能完成。<br/>请问,应该如何做,才能简化操作,取消这个”回车“的步骤?<br/><br/><br/>(defun c:tll (/ key ent1 el en n ss th val vt) <br/>&nbsp;&nbsp;(setq val 8);设置为图层匹配<br/>&nbsp;&nbsp;(prompt "\n当前匹配设置: 文字图层")<br/>&nbsp;&nbsp;(while (/= "TEXT" (cdr (assoc 0 en)))<br/>&nbsp; &nbsp; (initget "Set")<br/>&nbsp; &nbsp; (setq ent1 (entsel "\n选择源文字对象 :"))<br/>&nbsp; &nbsp; (if (= 'STR (type ent1))<br/>&nbsp; &nbsp;&nbsp; &nbsp;(progn&nbsp;&nbsp;<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(initget " L ")<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(setq key (getkword)) <br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(cond<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ((= key "L") (setq val 8 vt "文字图层"))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; (t (setq val 1 vt "文字内容"))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;);;;end cond<br/>&nbsp; &nbsp; &nbsp; &nbsp; ;;;(setq ent1 nil)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(prompt (strcat "\n当前匹配设置: " vt))<br/>&nbsp; &nbsp;&nbsp; &nbsp;);;;end progn<br/>&nbsp; &nbsp;&nbsp; &nbsp;(if ent1 (setq en (entget (car ent1))))<br/>&nbsp; &nbsp; );;;end if<br/>&nbsp;&nbsp;);;;end while<br/>&nbsp;&nbsp;;;;(setq en (entget ent1))<br/>&nbsp;&nbsp;(setq th (cdr (assoc val en)))<br/>&nbsp;&nbsp;(prompt "\n点取要修改的文字:")<br/>&nbsp;&nbsp;(setq ss (ssget '((0 . "TEXT"))))<br/>&nbsp;&nbsp;(if ss<br/>&nbsp; &nbsp; (progn<br/>&nbsp; &nbsp;&nbsp; &nbsp;(setq n 0)<br/>&nbsp; &nbsp;&nbsp; &nbsp;(command "undo" "group")<br/>&nbsp; &nbsp;&nbsp; &nbsp;(while (&lt; n (sslength ss))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(setq el (entget (ssname ss n)))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(entmod<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; (subst<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;(cons (car (assoc val el)) th)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;(assoc val el)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;el<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; )<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(setq n (1+ n))<br/>&nbsp; &nbsp;&nbsp; &nbsp;);;;end while<br/>&nbsp; &nbsp;&nbsp; &nbsp;(command "undo" "end")<br/>&nbsp; &nbsp;&nbsp; &nbsp;(prompt "\n匹配成功!(CS制作)")<br/>&nbsp; &nbsp;&nbsp; &nbsp;(princ)<br/>&nbsp; &nbsp; );;;end progn<br/>&nbsp; &nbsp; (progn<br/>&nbsp; &nbsp;&nbsp; &nbsp;(prompt "\n没有选到任何文本,退出!")<br/>&nbsp; &nbsp;&nbsp; &nbsp;(princ)<br/>&nbsp; &nbsp; )<br/>&nbsp;&nbsp;);;;end if<br/>)</div>

sailorcwx 发表于 2008-7-8 19:33:00

<p>把<br/>(setq ss (ssget '((0 . "TEXT"))))<br/>改成<br/>(setq ss (ssget ":S" '((0 . "TEXT"))))</p><p></p>

dengken204 发表于 2008-7-13 20:16:00

sailorcwx发表于2008-7-8 19:33:00static/image/common/back.gif把(setq ss (ssget '((0 . \"TEXT\"))))改成(setq ss (ssget \":S\" '((0 . \"TEXT\"))))

<p></p><p><strong><font face="Verdana" color="#61b713">sailorcwx</font></strong><strong><font face="Verdana" color="#61b713">兄的修改,是使得每次选取源文字后,只能匹配一个文字图层,我是希望能够想MASSPROP命令一样,可以连续匹配特性。</font></strong></p><p><strong><font face="Verdana" color="#61b713">也就是说,运行一次命令,可以连续匹配多个文字,而选择每个文字的过程中,都无需按回车</font></strong></p>

sailorcwx 发表于 2008-7-13 20:53:00

<p>那你加一个循环咯</p>
页: [1]
查看完整版本: [求助]如何简化LISP的“回车”操作?