nonsmall 发表于 2007-9-24 09:28:00

<p>推荐入门书 是上面说的PDF版本 PDG有缺页 这个是完整版(30个包)</p><p></p><p>另外两本的地址</p><p><a href="http://www.mjtd.com/bbs/dispbbs.asp?boardid=3&amp;replyid=64785&amp;id=61626&amp;page=1&amp;skin=0&amp;Star=5">http://www.mjtd.com/bbs/dispbbs.asp?boardid=3&amp;replyid=64785&amp;id=61626&amp;page=1&amp;skin=0&amp;Star=5</a></p><p></p><p>这个小程序用于选取图中的text实体,计算其数字和:<br/>;;;拾取数字求和&nbsp; &nbsp; &nbsp; &nbsp; <br/>(defun c:pickad&nbsp; &nbsp; &nbsp; &nbsp; (/ ss n totn adn)<br/>&nbsp;&nbsp;(prompt "\n拾取数字求和: ")<br/>&nbsp;&nbsp;(setq&nbsp; &nbsp; &nbsp; &nbsp; ss (ssget '((0 . "TEXT")))<br/>&nbsp; &nbsp; &nbsp; &nbsp; n&nbsp;&nbsp;0<br/>&nbsp;&nbsp;)<br/>&nbsp;&nbsp;(setq totn 0.0)<br/>&nbsp;&nbsp;(while (setq en (ssname ss n))<br/>&nbsp; &nbsp; (setq adn (atof (cdr (assoc 1 (entget en)))))<br/>&nbsp; &nbsp; (setq totn (+ totn adn))<br/>&nbsp; &nbsp; (setq n (1+ n))<br/>&nbsp;&nbsp;)<br/>&nbsp;&nbsp;(princ (strcat "\n数字和: "))<br/>&nbsp;&nbsp;(princ totn)<br/>&nbsp;&nbsp;(princ)<br/>)<br/></p><div class="subtable altbg1">2004-11-25 15:58<br/>&nbsp;&nbsp;&nbsp;<b>2443725</b></div><div class="subtable altbg2 t_msg" style="WIDTH: auto; HEIGHT: auto;">拾取数字和(可作减法)<br/>(defun c:pickad1 (/ psub1 ss totn)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br/>;拾取数字和(可作减法)<br/>&nbsp;&nbsp;(defun psub1 (ss / tot n en adn)<br/>&nbsp; &nbsp; (setq tot 0.0<br/>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;n&nbsp; &nbsp;0<br/>&nbsp; &nbsp; )<br/>&nbsp; &nbsp; (while (setq en (ssname ss n))<br/>&nbsp; &nbsp;&nbsp; &nbsp;(setq adn (atof (cdr (assoc 1 (entget en)))))<br/>&nbsp; &nbsp;&nbsp; &nbsp;(setq tot&nbsp; &nbsp; &nbsp; &nbsp; (+ tot adn)<br/>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;n&nbsp; &nbsp; &nbsp; &nbsp; (1+ n)<br/>&nbsp; &nbsp;&nbsp; &nbsp;)<br/>&nbsp; &nbsp; )<br/>&nbsp; &nbsp; tot<br/>&nbsp;&nbsp;)<br/><br/>&nbsp;&nbsp;(prompt "\n拾取数字求差: ")<br/>&nbsp;&nbsp;(prompt "\n请先选择被减的数字: ")<br/>&nbsp;&nbsp;(setq&nbsp; &nbsp; &nbsp; &nbsp; ss&nbsp; &nbsp;(ssget '((0 . "TEXT")))<br/>&nbsp; &nbsp; &nbsp; &nbsp; totn (psub1 ss)<br/>&nbsp;&nbsp;)<br/>&nbsp;&nbsp;(prompt "\n再选择要减去的数字: ")<br/>&nbsp;&nbsp;(setq&nbsp; &nbsp; &nbsp; &nbsp; ss&nbsp; &nbsp;(ssget '((0 . "TEXT")))<br/>&nbsp; &nbsp; &nbsp; &nbsp; totn (- totn (psub1 ss))<br/>&nbsp;&nbsp;)<br/>&nbsp;&nbsp;(princ (strcat "\n数字和: "))<br/>&nbsp;&nbsp;(princ totn)<br/>&nbsp;&nbsp;(princ)<br/>)<br/><div class="subtable altbg1">2004-11-25 15:59<br/>&nbsp;&nbsp;&nbsp;<b>2443725<br/></b>直接修改圆角半径<br/>改变已有的圆角半径:点选圆角弧,输入新半径值,自动重新圆角。<br/>我用它修改过道路转角半径,还算不错:}<br/>;;;MRADIUS.LSP&nbsp;&nbsp;直接修改FILLET直线半径.<br/>;;;<br/>;;;&nbsp; &nbsp;&nbsp;&nbsp;v0.5&nbsp;&nbsp;- 1998.1.25<br/>(defun c:mradius( / cget en ent ps1 ps2 e1 e2 r1 r2)<br/>&nbsp;(defun cget(pt siz lnm / ss eout en ent p1 p2 n)<br/>&nbsp; &nbsp; (setq ss <br/>&nbsp; &nbsp;&nbsp; &nbsp;(ssget "c" <br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(list (- (car pt) siz) (- (cadr pt) siz))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(list (+ (car pt) siz) (+ (cadr pt) siz))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(list '(0 . "LINE") (cons 8 lnm))<br/>&nbsp; &nbsp;&nbsp; &nbsp;)<br/>&nbsp; &nbsp; )<br/>&nbsp; &nbsp; (if ss (progn<br/>&nbsp; &nbsp;&nbsp; &nbsp;(setq n 0)<br/>&nbsp; &nbsp;&nbsp; &nbsp;(while (and (not eout) (setq en (ssname ss n)))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(setq ent (entget en)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;p1 (cdr (assoc 10 ent))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;p2 (cdr (assoc 11 ent)))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(if (or (equal p1 pt siz) (equal p2 pt siz))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; (setq eout en)) ;if<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(setq n (1+ n))<br/>&nbsp; &nbsp;&nbsp; &nbsp;)<br/>&nbsp; &nbsp; )) ;if<br/>&nbsp; &nbsp; eout<br/>&nbsp;&nbsp;) ;<br/>&nbsp;&nbsp;(setvar "cmdecho" 0)<br/>&nbsp;&nbsp;(command "undo" "group")<br/>(while&nbsp; &nbsp;(setq en (car (entsel)))<br/>&nbsp;&nbsp;(setq ent (entget en)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;o1 (cdr (assoc 10 ent))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;lnm (cdr (assoc 8 ent))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;r1 (cdr (assoc 40 ent))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;a1 (cdr (assoc 50 ent))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;a2 (cdr (assoc 51 ent)))<br/>&nbsp;&nbsp;(redraw en 3)<br/>&nbsp;&nbsp;(if (setq ls (getreal (strcat "半径&lt;" (rtos r1 2) "&gt;: ")))<br/>&nbsp; &nbsp; (setq r2 ls))<br/>&nbsp;&nbsp;(redraw en)<br/>;&nbsp;&nbsp;(setq r2 2000.0)<br/>&nbsp;&nbsp;(if (and r2 (/= r2 r1)) (progn<br/>&nbsp; &nbsp; (setq ps1 (polar o1 a1 r1) ps2 (polar o1 a2 r1))<br/>&nbsp; &nbsp; (setq e1 (cget ps1 0.1 lnm) e2 (cget ps2 0.1 lnm))<br/>&nbsp; &nbsp; (if (and e1 e2) (progn<br/>&nbsp; &nbsp;&nbsp; &nbsp;(entdel en)<br/>&nbsp; &nbsp;&nbsp; &nbsp;(setvar "filletrad" r2)<br/>&nbsp; &nbsp;&nbsp; &nbsp;(command "fillet" (list e1 ps1) (list e2 ps2))<br/>&nbsp; &nbsp; )) ;if<br/>&nbsp;&nbsp;)) ;if<br/>)<br/>&nbsp;&nbsp;(command "undo" "end")<br/>&nbsp;&nbsp;(princ)<br/>)<br/></div></div><div class="subtable altbg1">2004-11-25 16:01<br/>&nbsp;&nbsp;&nbsp;<b>2443725</b></div><div class="subtable altbg2 t_msg" style="WIDTH: auto; HEIGHT: auto;">如果你做施工图设计可能会用到标注配件编号,即从某配件上引出一条直线,在直线末端画一个圆圈,在圆圈中表一个编号,以便在材料表中注明配件名称规格等,这个<b style="COLOR: black; BACKGROUND-COLOR: #ffff66;">lisp</b>就是做这些的,如果你有用就拿去吧,程序还比较简陋,欢迎高手完善。<br/>(defun biaozhu (/ a1)<br/>&nbsp; &nbsp;(if (or (null r0) (= r0 0)) (setq r0 100))<br/>&nbsp; &nbsp;(if (null h0) (setq h0 100))<br/>&nbsp; &nbsp;(if (or (listp s0) (null s0) (numberp s0) (= s0 "") (not (tblsearch "style" s0))) (setq s0 (getvar "textstyle")))<br/>&nbsp; &nbsp;(if (or (listp text0) (null text0) (= text0 "")) (setq text0 "00"))<br/>&nbsp; &nbsp;(setq a1 T)<br/>&nbsp; &nbsp;&nbsp; &nbsp;(while a1(princ "The current Radius is &lt;")<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;(princ r0)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;(princ (strcat "&gt;&nbsp;&nbsp;The current Text-style is &lt;" s0 "&gt;"&nbsp;&nbsp;"\nThe current Text-high is &lt;"))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;(princ h0)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;(princ "&gt;")<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(initget "circle-Radius text-Stytle text-High Text")<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(setq a1 (getpoint "\ncircle-Radius/text-Stytle/text-High/Text/&lt;startpoint&gt;:"))<br/>&nbsp; &nbsp;<br/>&nbsp; &nbsp;&nbsp; &nbsp; (if a1<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;(cond ((= a1 "circle-Radius") (cradius))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ((= a1 "text-Stytle")&nbsp; &nbsp; (tstytle))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ((= a1 "text-High")&nbsp; &nbsp;&nbsp; &nbsp;(thigh))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ((= a1 "Text")&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(textx))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; (T&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; (drawline))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; )<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(setq a1 nil)<br/>&nbsp; &nbsp;&nbsp; &nbsp; )<br/>&nbsp; &nbsp;&nbsp; &nbsp;)<br/>)<br/></div><br/><div class="subtable altbg1">2004-11-25 16:02<br/>&nbsp;&nbsp;&nbsp;<b>2443725</b></div><div class="subtable altbg2 t_msg" style="WIDTH: auto; HEIGHT: auto;">一个螺旋线的 <br/>程序有一个小功能:记忆上次输入的数据。这样会方便很多。<br/>(defun c:rol1( / r1 r2 high hi stps p0 p1 p2 ang i hia)<br/>&nbsp;&nbsp;(command "undo" "group")<br/>&nbsp;&nbsp;(princ "\n绘制弹簧线....")<br/>&nbsp;&nbsp;(or #rol1_dat (setq #rol1_dat '(1000.0 3000.0 72 24)))<br/>&nbsp;&nbsp;(mapcar 'set '(r1 high stps stpp) #rol1_dat)<br/>&nbsp;&nbsp;(if (setq ls (getint (strcat "\n每圈步数&amp;lt;" (itoa stpp) "&amp;gt;: "))) (setq stpp ls))<br/>&nbsp;&nbsp;(setq ctr (getpoint "\n起点圆心: "))<br/>&nbsp;&nbsp;(if (setq ls (getdist ctr (strcat "\n半径&amp;lt;" (rtos r1 2 2) "&amp;gt;: "))) (setq r1 ls))<br/>&nbsp;&nbsp;(if (setq ls (getdist ctr (strcat "\n螺距&amp;lt;" (rtos high 2 2) "&amp;gt;: "))) (setq high ls))<br/>&nbsp;&nbsp;(if (setq ls (getint (strcat "\n总步数&amp;lt;" (itoa stps) "&amp;gt;: "))) (setq stps ls))<br/>&nbsp;&nbsp;(setq ang 0<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;p1 (polar ctr ang r1)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;hia (/ high stpp)<br/>&nbsp; &nbsp; &nbsp; &nbsp; i 0)<br/>&nbsp;&nbsp;(command "3dpoly" p1)<br/>&nbsp;&nbsp;(repeat stps<br/>&nbsp; &nbsp; (setq ang (+ ang (/ pi 12.0))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; i (1+ i)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; hi (* i hia))<br/>&nbsp; &nbsp; (command (mapcar '+ (polar ctr ang r1) (list 0 0 (* i hia))))<br/>&nbsp;&nbsp;) ;repeat<br/>&nbsp;&nbsp;(command "")&nbsp;&nbsp;<br/>&nbsp;&nbsp;(setq #rol1_dat (list r1 high stps stpp))<br/>&nbsp;&nbsp;(command "undo" "end")<br/>&nbsp;&nbsp;(princ)<br/>)</div><br/><br/><div class="subtable altbg1">2004-11-25 16:03<br/>&nbsp;&nbsp;&nbsp;<b>2443725</b></div><div class="subtable altbg2 t_msg" style="WIDTH: auto; HEIGHT: auto;">点选实体进行绘制。</div><div class="subtable altbg2 t_msg" style="WIDTH: auto; HEIGHT: auto;">这个程序基于这样的想法:<br/>作图的时候,要作的对象在图中已有同类的实体,则点取这个同类的实体,程序根据其类型调用相应的绘制命令。<br/>更有意义的是:程序会自动匹配颜色、线形、图层等参数,省去了许多转换操作。</div><div class="subtable altbg2 t_msg" style="WIDTH: auto; HEIGHT: auto;">LCMD.LSP<br/>;;;<br/>;;;<br/>(defun c:lcmd( / ss en nl nc nlt ladd n cc ent nthk ntp)<br/>&nbsp;&nbsp;(setvar "cmdecho" 0) </div><div class="subtable altbg2 t_msg" style="WIDTH: auto; HEIGHT: auto;">;;;主程序<br/>&nbsp;&nbsp;(setq en (entsel "\n请选择目标实体: "))<br/>&nbsp;&nbsp;(if en (progn<br/>&nbsp; &nbsp; (setq eent (entget (car en))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ntp (cdr (assoc 0 eent))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; nc (cdr (assoc 62 eent))&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;;颜色<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; nlt (cdr (assoc 6 eent))&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;;线型 <br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; nl (cdr (assoc 8 eent))&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ;层<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; nthk (cdr (assoc 39 eent))&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ;厚度<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; nelv (caddr (trans (cdr (assoc 10 eent)) 0 1))&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;;高度<br/>&nbsp; &nbsp; )<br/>&nbsp; &nbsp; (if nc (setvar "cecolor" nc) (setvar "cecolor" "bylayer"))<br/>&nbsp; &nbsp; (if nlt (setvar "celtype" nlt) (setvar "celtype" "bylayer"))<br/>&nbsp; &nbsp; (setvar "clayer" nl)<br/>&nbsp; &nbsp; (cond<br/>&nbsp; &nbsp;&nbsp; &nbsp;((= ntp "LINE") (command "line"))<br/>&nbsp; &nbsp;&nbsp; &nbsp;((= ntp "POLYLINE") (command "pline"))<br/>&nbsp; &nbsp;&nbsp; &nbsp;((= ntp "ARC") (command "arc"))<br/>&nbsp; &nbsp;&nbsp; &nbsp;((= ntp "3DFACE") (command "3dface"))<br/>&nbsp; &nbsp;&nbsp; &nbsp;((= ntp "SOLID") (command "solid"))<br/>&nbsp; &nbsp;&nbsp; &nbsp;((= ntp "INSERT") (command "insert"))<br/>&nbsp; &nbsp;&nbsp; &nbsp;((= ntp "CIRCLE") (command "circle"))<br/>&nbsp; &nbsp;&nbsp; &nbsp;((= ntp "TEXT")<br/>&nbsp; &nbsp;&nbsp; &nbsp; (setvar "textstyle" (cdr (assoc 7 eent)))<br/>&nbsp; &nbsp;&nbsp; &nbsp; (setvar "textsize" (cdr (assoc 40 eent)))<br/>&nbsp; &nbsp;&nbsp; &nbsp; (command "text")<br/>&nbsp; &nbsp;&nbsp; &nbsp;)<br/>&nbsp; &nbsp;&nbsp; &nbsp;((= ntp "DIMENSION")<br/>&nbsp; &nbsp;&nbsp; &nbsp;)<br/>&nbsp; &nbsp;&nbsp; &nbsp;((= ntp "INSERT")<br/>&nbsp; &nbsp;&nbsp; &nbsp; (setq nin (cdr (assoc 2 eent)))<br/>&nbsp; &nbsp;&nbsp; &nbsp; (setvar "isname" nin)<br/>&nbsp; &nbsp;&nbsp; &nbsp; (command "insert")<br/>&nbsp; &nbsp;&nbsp; &nbsp;)<br/>&nbsp; &nbsp;&nbsp; &nbsp;(t)<br/>&nbsp; &nbsp; ) ;cond<br/>&nbsp; &nbsp;) ;progn<br/>&nbsp;&nbsp;)&nbsp;&nbsp;;if<br/>&nbsp;&nbsp;(princ)<br/>)</div><br/>

mingvictor 发表于 2007-9-25 09:26:00

楼主,劳苦功高啊!谢谢先!正是有了像楼主这样的人!我的坛子才会比别的坛子人气好啊!

YDPLDL 发表于 2007-10-4 15:23:00

多谢楼主,顶一下.

zhongzilei 发表于 2007-10-5 15:40:00

<p>好资料,正要好好学学lisp,目前也只是一知半解</p><p></p>

vkzhang 发表于 2007-10-12 14:16:00

<p>支持一下</p><p></p>

lu_618 发表于 2007-10-14 15:49:00

<p>谢谢有这么多的资料可以下载,顶一下,哈哈</p>

lsclover 发表于 2007-10-16 22:57:00

谢谢!!辛苦了!!!

wb1108 发表于 2007-10-19 21:32:00

<p>谢谢,新手,学习学习</p>

pepsi04 发表于 2007-10-23 21:56:00

ddd

wgg1209 发表于 2007-11-17 16:23:00

太有才了,搂住真牛
页: 1 2 [3] 4 5 6 7 8 9 10 11 12
查看完整版本: 【不死猫出品】【2008.11月《71楼更新》】※LISP 教程 工具 帮助 风玫瑰图