编写一LISP程序,是autoCAD
1个回答
2016-04-27 · 知道合伙人软件行家
关注
展开全部
写了一个程序,参考一下。
(defun c:tes ( / &ang1 &ang2 &ang3 &dis1 &n1 &p1 &p2 &p3 &p4 &p5 &p6 &ss1 pt1 pt2 pt3)
(setvar "cmdecho" 0)
(setvar "blipmode" 0)
(if (null (setq &n1 (getint (strcat "\n请输入行默认:<" "1" ">")))) (setq &n1 1) )
(if (and
(> &n1 0)
(setq &p1 (getpoint "\n请指定基点"))
(setq &dis1 (getdist &p1 "\n请输入半径"))
(> &dis1 0)
)
(progn
(setq &ang1 (/ pi 3) &ang2 (/ (* pi 5) 6) &ss1 '())
(setq &p2 (polar &p1 &ang2 &dis1) &ss1 (cons &p2 &ss1) &ang2 (/ (* pi 2) 3))
(setq &p2 (polar &p1 (* 1.5 pi) &dis1) &ss1 (cons &p2 &ss1))
(repeat &n1
(entmake (list '(0 . "CIRCLE") (cons 10 &p1) (cons 40 &dis1)))
(setq &p2 &p1)
(repeat (- &n1 1)
(setq &p2 (polar &p2 &ang1 (* &dis1 2)))
(entmake (list '(0 . "CIRCLE") (cons 10 &p2) (cons 40 &dis1)))
)
(setq &p2 &p1 &p1 (polar &p1 0 (* &dis1 2)) &n1 (- &n1 1))
);repeat
(setq &ang3 (/ pi 6))
(setq &p1 (polar &p2 &ang3 &dis1) &p2 (polar &p1 &ang2 &dis1) &p3 (car &ss1))
(setq &p4 (polar &p3 0 &dis1) pt1 (inters &p1 &p2 &p3 &p4 nil) &p5 (cadr &ss1));求交点绘制三角形
(setq &p6 (polar &p5 &ang1 &dis1) pt2 (inters &p1 &p2 &p5 &p6 nil) pt3 (inters &p3 &p4 &p5 &p6 nil))
(entmake (list '(0 . "LINE") (cons 10 pt1) (cons 11 pt2)))
(entmake (list '(0 . "LINE") (cons 10 pt1) (cons 11 pt3)))
(entmake (list '(0 . "LINE") (cons 10 pt3) (cons 11 pt2)))
);progn
)
(princ)
)
更多追问追答
追问
蟹蟹蟹😂😂😂
&是什么意思?我们没学过😂而且你可以用循环来编一下吗?我们这是一个小论文作业,还要流程图,要不你可以帮我画个流程图好吗?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询