明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1746|回复: 2

为什么,望解答,2例

[复制链接]
发表于 2004-2-25 08:30:00 | 显示全部楼层 |阅读模式
http://computer.blogger.cn/reddante/ 上面有我的两例代码,其中的错误或用的不对的地方,望各位帮偶~
发表于 2004-2-25 14:04:00 | 显示全部楼层
是捕捉點出問題 ;;這是畫n角星的代碼
(defun C:STARN (/ HOLDOSMODE)
;;;輸入n角星的角數,判斷,和基本資料的計算
(setq N (getint "\nplease input a int n: "))
(if (< N 4)
(alert "\nwhat are you doing?")
)
(setq CENTER (getpoint "\nplease input center point: "))
(command "_.point" CENTER)
(setq P1 (getpoint CENTER "\nplease input 1st point: "))
(setq ANG (angle CENTER P1))
(setq DIS (distance CENTER P1))
(setq MINA (* pi (/ (/ 360.0 N) 180)))
(setq A (* pi (/ (/ 720.0 N) 180)))
(setq HOLDOSMODE (getvar "OSMODE"))
(setvar "OSMODE" 0)
;;;判斷n角星為奇還是偶。
(if (= (* 2 (/ N 2)) N)
;;;為偶
(progn
(command "_.pline" P1 (polar CENTER (+ A ANG) DIS))
(setq I 1)
(while (< I (/ N 2))
(command (polar CENTER (+ (* A I) ANG) DIS))
(setq I (1+ I))
)
(command "c")
(command "_.copy" (entlast) "" "0,0" "@")
(command "_.rotate" (entlast) "" CENTER (/ 360.0 N))
)
;;;為奇
(progn
(command "_.pline" P1 (polar CENTER (+ A ANG) DIS))
(setq I 1)
(while (< I N)
(command (polar CENTER (+ (* A I) ANG) DIS))
(setq I (1+ I))
)
(command "c")
)
)
(setvar "OSMODE" HOLDOSMODE)
;;;結束,列印作者資訊
(alert
"\nThe script running successful!\nGood Luck!\nCode By Redd4n7E!\n 修改 龍龍仔!"
)
(princ)
)
 楼主| 发表于 2004-2-25 15:33:00 | 显示全部楼层
谢谢,谢谢,
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-27 16:51 , Processed in 0.188825 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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