切切半径程序
本帖最后由 作者 于 2008-6-12 17:45:10 编辑;;;改编:BDYCAD
;;;时间:2008-06-12 (17:43)
(defun c:ccc(/ A1P1 A1P2 A1P3 A2P1 A2P2 A2P3 C1 C2 DELC1 DELC2 E1 E2 OBJ1 OBJ2 PTLST R1 R2 R3 YX1 YX)
(setq yx1 (list 100 300))
(setq yx2 (list 500 300))
(setq r1 100 r2 200 R3 1000)
(COMMAND "circle" yx1 r1 )
(setq e1 (entlast))
(COMMAND "circle" yx2 r2 )
(setq e2 (entlast))
(setq c1 (polar yx1 (* 0.5 pi) r1 )
c2 (polar yx2 (* 0.5 pi) r2 ))
(COMMAND "circle" yx1 (- R3 R1))
(SETQ DelC1(entlast))
(COMMAND "circle" yx2 (- R3 R2))
(SETQ DelC2(entlast))
(setq obj1 (vlax-ename->vla-object DelC1)
obj2 (vlax-ename->vla-object DelC2)
ptlst (xl-div (vlax-invoke obj1 'IntersectWith obj2 0) 3))
(entdel DelC1)
(entdel DelC2)
(setq A1p1(polar(car ptlst)(angle(car ptlst)yx1)R3)
A1p3(polar(car ptlst)(angle(car ptlst)yx2)R3)
A1p2(polar(car ptlst)(angle(car ptlst)(polar A1p1(angle A1p1 A1p3)(*(distance A1p1 A1p3)0.5)))R3))
(command"Arc"A1p1 A1p2 A1p3)
(setq A2p1(polar(cadr ptlst)(angle(cadr ptlst)yx1)R3)
A2p3(polar(cadr ptlst)(angle(cadr ptlst)yx2)R3)
A2p2(polar(cadr ptlst)(angle(cadr ptlst)(polar A1p1(angle A2p1 A2p3)(*(distance A2p1 A2p3)0.5)))R3))
(command"Arc"A2p1 A2p2 A2p3)
)
(defun xl-div (lst x / lst2)
(foreach n lst
(if (andlst2 (/= x (length (car lst2))))
(setq lst2 (cons (append (car lst2) (list n)) (cdr lst2)))
(setq lst2 (cons (list n) lst2))))
(reverse lst2))
(defun c:ccc () (command "circle" "t"))
就这个可以了,那么复杂 有切切直径的才更有意义!
页:
[1]