给圆弧画切线并相交
- (defun c:yh()
- (command "cmdecho" 0 "osnapcoord" 1)
- (setq entdata(entget(car(entsel"\n选择圆弧:"))))
- (setq p0(cdr(assoc 10 entdata)))
- (setq a1(cdr(assoc 50 entdata)))
- (setq a2(cdr(assoc 51 entdata)))
- (setq r(cdr(assoc 40 entdata)))
- (setq p1(polar p0 a1 r)
- p2(polar p0 a2 r))
- (setq y0(cadr p0)
- x0(car p0)
- y1(cadr p1)
- x1(car p1)
- y2(cadr p2)
- x2(car p2))
- (setq k1(/(- y0 y1)(- x0 x1))
- k2(/(- y0 y2)(- x0 x2)))
- (setq y(/(+(- x1 x2 (* k2 y2))(* k1 y1))(- k1 k2))
- x(+(-(* k1 y1)(* k1 y))x1))
- (setq p4(list x y))
- (c:qx)
- (command "line" p1 p4 p2 "")
- (princ)
- )
|