AutoCAD LISP凹型图
2011-03-27 14:29 精诚所至 金石为开 阅读(419) 评论(0) 编辑 收藏 举报AutoCAD LISP根据输入左下角点、宽度和高度绘制”凹“行型图,代码如下。
(defun c:test()
(setvar "cmdecho" 0)
(setq pt1 (getpoint "\n选取图形左下角点:"))
(setq ww (getdist pt1 "\n宽度:"))
(if (null ww) (setq ww 100))
(setq hh (getdist pt1 "\n高度<50>:"))
(if (null hh) (setq hh 50))
(setq ww3 (/ ww 3))
(setq hh2 (/ hh 2))
(setq pt2 (polar pt1 0 ww))
(setq pt3 (polar pt2 (/ pi 2) hh))
(setq pt4 (polar pt3 pi ww3))
(setq pt5 (polar pt4 (* pi 1.5) hh2))
(setq pt6 (polar pt5 pi ww3))
(setq pt7 (polar pt6 (/ pi 2) hh2))
(setq pt8 (polar pt7 pi ww3))
(command "pline" pt1 pt2 pt3 pt4 pt5 pt6 pt7 pt8 "c")
(prin1)
)
代码完。
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)