kristytian 发表于 2008-10-31 22:10:00

请教高手lisp不能正常应用

<p>小弟最近下雨闲得无聊修改了份lisp小程序,可是tm1~tm9和图块ac50tk死活显示不出来,程序如下,请高手给予正解,谢谢</p><p>(defun c:jtk()<br/>&nbsp;&nbsp;(setq xinan (GETpoint "\n请拾取或输入1:500图框的西南图廓点坐标:"))<br/>&nbsp;&nbsp;(setq tm (getstring "\n请输入图名:"))<br/>&nbsp;&nbsp;(command "layer" "s" "tk" "")<br/>&nbsp;&nbsp;(setq x0 (nth 0&nbsp; xinan) y0 (nth 1 xinan) h0 (nth 2 xinan))<br/>&nbsp;&nbsp;(setq xk (/ x0 1000))<br/>&nbsp;&nbsp;(setq yk (/ y0 1000))<br/>&nbsp;&nbsp;(setq x (rtos xk 2 2))<br/>&nbsp;&nbsp;(setq y (rtos yk 2 2))<br/>&nbsp;&nbsp;(setq tmy1 (rtos (- (atof y) 0.25) 2 2))<br/>&nbsp;&nbsp;(setq tmx1 (rtos (- (atof x) 0.25) 2 2))<br/>&nbsp;&nbsp;(setq tmyy (rtos (+ (atof y) 0.25) 2 2))<br/>&nbsp;&nbsp;(setq tmxx (rtos (+ (atof x) 0.25) 2 2))<br/>&nbsp;&nbsp;(setq th (strcat x "-" y))<br/>&nbsp;&nbsp;(setq dtk1 (polar xinan 0 257.5))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;(setq dth (polar dtk1 1.570796 125))<br/>&nbsp;&nbsp;(setq dtkk (polar xinan 0 261.5))<br/>&nbsp;&nbsp;(setq dtm (polar dtkk 1.570796 125))<br/>&nbsp;&nbsp;(command "style" "winht" "simhei.ttf" "3.0" "0.8" "" "" "")<br/>&nbsp;&nbsp;(command "text"&nbsp; "j" "m" dtm "" tm)<br/>&nbsp;&nbsp;(command "style" "winht" "simhei.ttf" "3.0" "0.8" "" "" "")<br/>&nbsp;&nbsp;(command "text" "j" "m" dth&nbsp; "" th)<br/>&nbsp;&nbsp;(setq tm1(strcat tmxx "-" tmy1))<br/>&nbsp;&nbsp;(setq tm2(strcat tmxx "-" y))<br/>&nbsp;&nbsp;(setq tm3(strcat tmxx "-" tmyy))<br/>&nbsp;&nbsp;(setq tm4(strcat x "-" tmy1))<br/>&nbsp;&nbsp;(setq tm6(strcat x "-" tmyy))<br/>&nbsp;&nbsp;(setq tm7(strcat tmx1 "-" tmy1))<br/>&nbsp;&nbsp;(setq tm8(strcat tmx1 "-" y))<br/>&nbsp;&nbsp;(setq tm9(strcat tmx1 "-" tmyy))<br/>&nbsp;&nbsp;(setq dtk (polar xinan 0 250))<br/>&nbsp;&nbsp;(setq dtm1(polar dtk 0 15.5))<br/>&nbsp;&nbsp;(setq dtm2(polar dtm1 1.570796 7.5))<br/>&nbsp;&nbsp;(setq dtm3(polar dtm1 1.570796 15))<br/>&nbsp;&nbsp;(setq dtm4(polar dtk 0 11.5))<br/>&nbsp;&nbsp;(setq dtm6(polar dtm4 1.570796 15))<br/>&nbsp;&nbsp;(setq dtm7(polar dtk 0 7.5))<br/>&nbsp;&nbsp;(setq dtm8(polar dtm7 1.570796 7.5))<br/>&nbsp;&nbsp;(setq dtm9(polar dtm7 1.570796 15))<br/>&nbsp;&nbsp;(command "style" "hz" "rs.shx" "1.2" "0.8" "" "" "")<br/>&nbsp;&nbsp;(command "text" "j" "m" dtm1 "" tm1)<br/>&nbsp;&nbsp;(command "text" "j" "m" dtm2 "" tm2)<br/>&nbsp;&nbsp;(command "text" "j" "m" dtm3 "" tm3)<br/>&nbsp;&nbsp;(command "text" "j" "m" dtm4 "" tm4)<br/>&nbsp;&nbsp;(command "text" "j" "m" dtm6 "" tm6)<br/>&nbsp;&nbsp;(command "text" "j" "m" dtm7 "" tm7)<br/>&nbsp;&nbsp;(command "text" "j" "m" dtm8 "" tm8)<br/>&nbsp;&nbsp;(command "text" "j" "m" dtm9 "" tm9)<br/>&nbsp;&nbsp;(command "insert" "C:\\CASS70\\BLOCKS\\Ac50tk.dwg" xinan "xyz" "1" "1" "1" "")<br/>&nbsp;&nbsp;(command "layer" "s" "0" "")<br/>&nbsp;&nbsp;(command "redraw")<br/>&nbsp;&nbsp;(command "zoom" "e")<br/>&nbsp;&nbsp;(princ "\n * 图幅整饰完成 * ") <br/>&nbsp;&nbsp;(print )<br/>&nbsp;<br/>)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp; <br/></p>

caoyin 发表于 2008-11-1 09:52:00

<p>没细看,关掉osmode试试:</p><p>(setvar "osmode" 0)</p>

greateman 发表于 2008-11-1 19:02:00

<p>不行啊,程序执行完text命令后就返回了style命令,并出现函数被取消的反馈!</p><p>看了下,应该没有语法错误的阿</p>
页: [1]
查看完整版本: 请教高手lisp不能正常应用