(defun
C:pxsb
()
(setvar
"cmdecho"
0)
(setq
pt1
(getpoint
"\n请输入平行四边形起点:"))
(setq
s1
(getdist
pt1
"\平行四边形一个边长:"))
(setq
s2
(getdist
pt1
"\平行四边形另一个边长:"))
(setq
w
(getangle
"\平行四边形宽夹角:"))
(setq
pt2
(polar
pt1
0
s1))
(setq
pt3
(polar
pt2
w
s2))
(setq
pt4
(polar
pt1
w
s2))
(command
"pline"
pt1
pt2
pt3
pt4
"c")
(setvar
"cmdecho"
1)
(princ)
)
(defun
C:txy
()
(setvar
"cmdecho"
0)
(setq
cen
(getpoint
"\n请输入同心圆圆心:"))
(setq
d1
(getdist
pt1
"\n输入第一个圆的直径:"))
(setq
d2
(getdist
pt1
"\n输入第二个圆的直径:"))
(setq
d3
(getdist
pt1
"\n输入第三个圆的直径:"))
(command
"circle"
cen
"d"
d1)
(command
"circle"
cen
"d"
d2)
(command
"circle"
cen
"d"
d3)
(setvar
"cmdecho"
1)
)
(defun c:tes ( / i n p1 p2 r r1 r2 r3 r4 ss1 ss2)(vl-load-com)
(if (and
(setq p1 (getpoint "\n请选择同心圆圆心"))
(setq r1 (s180828a p1 "\n请输入第一个同心圆半径:"))
(setq r2 (s180828a p1 "\n请输入第二个同心圆半径:"))
(setq r3 (s180828a p1 "\n请输入第三个同心圆半径:"))
(setq p2 (polar p1 0 (setq r4 (cadr (setq ss1 (vl-sort (list r1 r2 r3) '<))))))
(setq r (s180828a p2 "\n请输入小圆半径"))
(setq n (s180828s))
)
(progn
(setq ss2 '())
(while (setq r1 (car ss1))
(setq ss1 (cdr ss1))
(entmake (list '(0 . "CIRCLE") (cons 10 p1) (cons 40 r1)))
(setq ss2 (cons (entlast) ss2))
)while
(setq i -1.0)
(while (< (setq i (1+ i)) n)
(setq p2 (polar p1 (/ (* pi i 2) n) r4))
(entmake (list '(0 . "CIRCLE") (cons 10 p2) (cons 40 r)))
)while
)
)
(princ)
)autolisp程序,复制到记事本,以【.lsp】为后缀命名,AutoCAD命令【appload】加载。
输入圆半径
(defun s180828a (p1 str1 / p1 str1)
(initget 6)
(getdist p1 str1)
)
输入小圆数量
(defun s180828s ()
(initget 6)
(getint "\n请输入小圆数量:")
)
(defun c:drawing()(setvar "cmdecho" 0)
(setq ptcenter (getpoint "\n请输入圆心位置:"))
(setq dist(getdist "\n请输入基圆半径:"))
(command "_circle" ptcenter dist)
(command "_circle" ptcenter (* dist 1.2) )
(command "_circle" ptcenter (* dist 1.2 1.2) )
(command "_circle" ptcenter (* dist 1.2 1.2 1.2) )
(princ)
)
再保存为drawing.lsp就OK了...
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)