AutoCAD矩形交叉口框短边切圆二
2011-03-27 16:11 精诚所至 金石为开 阅读(304) 评论(0) 编辑 收藏 举报AutoCAD矩形交叉口框短边切圆二,代码如下。
(defun c:test()
(setvar "cmdecho" 0)
(setq pt1 (getpoint "\n第一角点:"))
(setq pt3 (getcorner pt1 "\n另一角点:"))
(setq pt2 (list (car pt3) (cadr pt1)))
(setq pt4 (list (car pt1) (cadr pt3)))
(command "rectang" pt1 pt3)
(setq int (inters pt1 pt3 pt2 pt4))
(setq ww (distance pt1 pt2))
(setq hh (distance pt2 pt3))
(setq cir1 (/ (min ww hh) 2))
(setq pt5 (polar int (angle int pt1) cir1))
(setq pt6 (polar int (angle int pt2) cir1))
(setq pt7 (polar int (angle int pt3) cir1))
(setq pt8 (polar int (angle int pt4) cir1))
(command "arc" pt5 "e" pt6 "r" cir1)
(command "arc" pt7 "e" pt6 "r" cir1)
(command "arc" pt7 "e" pt8 "r" cir1)
(command "arc" pt5 "e" pt8 "r" cir1)
(command "line" pt5 pt7 "")
(command "line" pt6 pt8 "")
(prin1)
)
代码完。
第一点只能在左下,第三点在右上,并且高度应该大于宽度,不让有BUG。