明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1361|回复: 3

程序不按设想执行

[复制链接]
发表于 2004-9-1 16:37:00 | 显示全部楼层 |阅读模式
我在执行这个程序时,无论怎样都不能画出内接圆,不知道为什么? (defun c:7test3()
;以下 pa、ww、hh、n 值须由使用者输入
(setq n (getint "请求输入正多边形边数,N="))
(initget "C c I i")
(setq ic (getkword "请决定时内切(I)还是外接(C): "))
(setq en (entsel "\n选取欲作内切正多边形的圆: "))
(setq I 0)
(while en ;;;当en存在时,做以下循环内容,直到en不存在为止
(setq en_data (entget (car en)))
(setq en_type(cdr (assoc 0 en_data))) ;群码0为对象类别
(if (= en_type "CIRCLE")
(progn
(setq cenpt (cdr (assoc 10 en_data)))
(setq rad (cdr (assoc 40 en_data)))
(if (= ic i) ;;;如果ic是i,画内切圆,如果ic是c,画外接圆。
(command "polygon" n cenpt "i" rad)
(command "polygon" n cenpt "c" rad)
)
(setq I (1+ I))
)
(alert "该对象并不是圆,请重新选取圆")
) ;end if
(setq en (entsel "\n选取下一个欲作内切正多边形的圆: "))
)
(princ (strcat "\n共绘制了" (itoa i) "圆内切正多边形"))
(prin1)
)
(prompt "\n << 7TEST3>>连续对多个圆绘制内切正多边形")
(prin1)
发表于 2004-9-1 17:03:00 | 显示全部楼层
(if (or (= ic "i")(= ic "I")) ;;;如果ic是i,画内切圆,如果ic是c,画外接圆。
(command "polygon" n cenpt "i" rad)
(command "polygon" n cenpt "c" rad)
)
 楼主| 发表于 2004-9-2 08:24:00 | 显示全部楼层
谢谢大虾,程序已经正常了,但我不理解 比如我把这句 (initget "C c I i")
改为 (initget "c i") 判断时仍是这句:(if (= ic i) 输入时准确的输入小写i,为什么程序还是不能正确执行。
发表于 2004-9-2 11:47:00 | 显示全部楼层
(if (= ic "i")...
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-9-30 18:20 , Processed in 0.165584 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表