QUAN2518 发表于 2006-8-14 12:02:00

帮我分析

<P>帮忙分析下面的问题</P>
<P>;以下是通过用户给出矩形的左下角点、长、宽;自动绘制图形的LISP小程序。<BR>;设计者:Quan<BR>;日期:2006年8月14日。<BR>(defun c:pbox (/ pa pb pc pd ww hh mp1 mp2 mp3 mp4)<BR>&nbsp; (setvar "cmdecho" 0)<BR>&nbsp; (setvar "blipmode" 0)<BR>&nbsp; ;以下是用户输入量"pa ww hh"<BR>&nbsp; (setq pa (getpoint "左下角点:"))<BR>&nbsp; (setq ww (getdist " \n长度h:"))<BR>&nbsp; (setq hh (getdist "\n宽度:"))<BR>&nbsp; ;以下根据pa、ww、hh计算其它量。<BR>&nbsp; (setq pb (polar pa 0 ww))<BR>&nbsp; (setq pc (polar pb (/ pi 2) hh))<BR>&nbsp; (setq pd (polar pd pi ww))<BR>(command "pline" pa pb pc pd "c")<BR>&nbsp; ;以下计算mp1 mp2 mp3 mp4<BR>&nbsp; (setq mp1 (polar pa 0 (/ ww 2)))<BR>&nbsp; (setq mp2 (polar pb (/ pi 2) (/ hh 2)))<BR>&nbsp; (setq mp3 (polar pc pi (/ ww 2)))<BR>&nbsp; (setq mp4 (polar pa (/ pi 2) (/ hh 2)))<BR>&nbsp; ;以下绘制直线<BR>&nbsp; (command "line" mp1 mp3"")<BR>&nbsp; (command "line" mp2 mp4"")<BR>(prin1)<BR>&nbsp; )<BR>(prompt"\n《c:pbox》制作者OEM")<BR>(prompt"\n欢迎使用")]<BR>(prin1)</P>
<P>执行后出现</P>
<P>命令: pbox 左下角点:<BR>长度h:300<BR>宽度:200<BR>; 错误: 参数类型错误: 二维/三维点: nil</P>
<P>和教材上一样为什么我写的就不能执行呢。。。。</P>

f5612140 发表于 2006-8-14 12:31:00

(setq pd (polar pc pi ww))

zmzk 发表于 2023-1-30 19:24:28

(setq mp2 (polar pb (/ pi 2) (/ hh 2))中的pi代表什么意思?

zml84 发表于 2023-2-3 07:25:21

zmzk 发表于 2023-1-30 19:24
(setq mp2 (polar pb (/ pi 2) (/ hh 2))中的pi代表什么意思?

piπ圆周率

zml84 发表于 2023-2-3 07:26:53

另,多说一句:(/ hh 2))建议写为 (*0.5hh ))
页: [1]
查看完整版本: 帮我分析