AutoCAD LISP循环判断自动绘制楼梯
2011-03-26 23:57 精诚所至 金石为开 阅读(729) 评论(0) 编辑 收藏 举报AutoCAD LISP REPEAT循环判断根据左下角点、楼梯高度、高度和阶数自动绘制楼梯,代码如下。
(defun c:test()
(setq pa (getpoint "请输入左下角点:"))
(setq ww (getdist pa "\n请输入楼梯宽度:"))
(setq hh (getdist pa "\n请输入楼梯高度:"))
(setq n (getint "\n请输入楼梯阶数:"))
(setq pb (polar pa 0 ww))
(setq pc (polar pb (/ pi 2) hh))
(command "line" pa pb pc "")
(setq dw (/ ww n))
(setq dh (/ hh n))
(setq pp pa)
(repeat n
(setq p1 (polar pp (/ pi 2) dh))
(setq p2 (polar p1 0 dw))
(command "line" pp p1 p2 "")
(setq pp p2)
)
(prin1)
)
(prompt "\n<<test>>快速自动绘制楼梯")
(prin1)
代码完。