圆画中心线,小韩和小星的代码
波总群里的代码,加群群号437857444,非常好的交流群,圆画中心线,小韩和小星的代码(defun c:zxx(/ i l osm p1 p2 p3 p4 pa pb pt0 r s1 ss)
(setvar "CMDECHO" 0)
(while
(and
(setq
pa (getpoint "选择圆:")
pb (getcorner pa)
ss (ssget "c" pa pb '((0 . "circle")))
osm (getvar "osmode")
l (getreal "\n 请输入中心线延伸长度(mm):")
)
)
(if ss
(progn
(setq i -1)
(setvar "osmode" 0)
(repeat (sslength ss)
(setq
s1 (entget (ssname ss (setq i (1+ i))))
pt0 (cdr (assoc 10 s1))
r (cdr (assoc 40 s1))
)
(command "layer" "m" 5 "l" "center" 5 "c" 1 5 "")
(command "ltscale" 8);设置线型比例
(setq
p1 (polar pt0 0 (/ l 2))
p2 (polar pt0 pi (/ l 2))
p3 (polar pt0 (* 0.5 pi) (/ l 2))
p4 (polar pt0 (* -0.5 pi) (/ l 2))
)
(command "line" p1 p2 "")
(command "line" p3 p4 "")
(command "layer" "s" 0 "")
)
(setvar "osmode" osm)
)
)
)
)
(defun C:zxx(/)
(setvar "osmode" 512)
(if (SETQpc (ssget '((0 . "CIRCLE"))));画选ssget
(progn
(SETQl (getreal "\n 请输入中心线延伸长度(mm):"))
(setq i 0)
(repeat (sslength pc)
(SETQs1(entget(ssname pc i))
pt0(cdr(assoc 10 s1));获得圆心坐标
r (cdr(assoc 40 s1));获得圆的半径
)
(command "layer" "m" 5 "l" "center" 5 "c" 1 5 "")
(command "ltscale" 8);设置线型比例
(command "line"(polar pt0 pi (+ r l)) (polar pt0 0 (+ r l)) "")
(command "line" (polar pt0 (* pi 0.5) (+ r l)) (polar pt0 (* pi 1.5) (+ r l)) "")
(command "layer" "s" 0 "")
(setq i (1+ i))
)
);progn
);if
(PRINC)
);end defun
具体啥作用呢?是画个圆后就自动出来中心线那种?中心线能指定长短吗?可以十字型出现么? 还是很感谢分享的,有时会用得到,看看是不是适合我的这种
页:
[1]