[求助]下面的LISP有何问题?
<P>我想用LISP画一个多个等半径圆想切,图如附件,但下面的程序却只能画出第一个圆,我不知道为什么,不知道有没有高手指点一下?</P><P>(defun c:sc(/ p r num ang1 ang2 dd ce)<BR> (setq p (getpoint "\n基点:")<BR> r (getdist "\n小圆半径")<BR> num(getint "\n数量:")<BR> ang1(/ pi num)<BR> ang2(- (/ pi 2) ang1)<BR> dd (/ r (sin ang1))<BR> ce (polar p ang2 dd)<BR> )<BR> (command "circle" ce r)<BR> (command "array" (entlast) "" "p" ce num 360 "y")<BR> (princ)<BR>)</P> <P> (command "circle" ce r)</P>
<P>圆的基点错了 </P>
<P>把ce 改成 p就可以了</P>
<P>改后如下:</P>
<P>(defun c:sc(/ p r num ang1 ang2 dd ce)<BR> (setq p (getpoint "\n基点:")<BR> r (getdist "\n小圆半径")<BR> num(getint "\n数量:")<BR> ang1(/ pi num)<BR> ang2(- (/ pi 2) ang1)<BR> dd (/ r (sin ang1))<BR> ce (polar p ang2 dd)<BR> )<BR> (command "circle" p r)<BR> (command "array" (entlast) "" "p" ce num 360 "y")<BR> (princ)<BR>)</P>
<P> </P> 如果p指圆心的圆点,如楼上,如果p指阵列的中心点改command这句(command "array" (entlast) "" "p" p num 360 "y") 不知道你这个p(基点指的是什么)<BR> 修改后的程序:
(defun c:sc(/ p r num ang1 ang2 dd ce)
(setq p(getpoint "\n基点:")
r(getdist "\n小圆半径")
num(getint "\n数量:")
ang1(/ pi num)
ang2(- (/ pi 2) ang1)
dd (/ r (sin ang1))
ce (polar p ang2 dd)
)
(command "circle" ce r)
(command "array" "l" "" "p" p num "" "y")
(princ)
)
建议将函数名改一下,不要用c:sc。
谢谢各位帮助呀,我现在已经弄成了!
页:
[1]