凸度=拱高/弦长的一半,如果弧从起点到终点是顺时针走向则凸度为负数,0表示直线,1表示半圆。
dxf组码 42
 - ;;两点半径求凸度
- (defun sk_2pr->bulge (p1 p2 r / mpt a b k bulge)
- (if (and p1
- p2
- r
- (= (type p1) 'LIST)
- (= (type p2) 'LIST)
- (numberp r)
- )
- (progn
- (setq mpt (mapcar '(lambda (x y) (* 0.5 (+ x y))) p1 p2)
- a (distance p1 mpt)
- b (sqrt (- (* r r) (* a a)))
- k (- r b)
- bulge (/ k a)
- )
- )
- )
- )
- (defun c:ac()
- (princ"\n画A冲")
- (setvar "cmdecho" 0)
- (command "ucs" "w")
- (setq a (getreal "\n输入A冲直径:"))
- (setq b (getreal "\n输入P端直径:"))
- (setq c (getreal "\n输入P端长度:"))
- (setq d (getreal "\n输入总长度:"))
- (setq P (getpoint "\n放置点:"))
- (setq x(car p))
- (setq y(cadr p))
- (setq P1 (list (- x (+ (/ a 2) 1.5)) y))
- (setq P2 (list (+ x (+ (/ a 2) 1.5)) y))
- (setq P3 (list (+ x (+ (/ a 2) 1.5)) (- y 5)))
- (setq P4 (list (+ x (/ a 2)) (- y 5)))
- (setq P5 (list (- x (/ a 2)) (- y 5)))
- (setq P6 (list (- x (+ (/ a 2) 1.5)) (- y 5)))
- (setq P9 (list (- x (/ b 2)) (- y (- d c))))
- (setq P10 (list (+ x (/ b 2)) (- y (- d c))))
- (setq P11 (list (- x (/ b 2)) (- y d)))
- (setq P12 (list (+ x (/ b 2)) (- y d)))
- (setq h (sqrt (- 100 (expt(- 10 (/ (- a b) 2)) 2))))
- (setq P8 (list (+ x (/ a 2)) (- y (- d (+ c h)))))
- (setq P7 (list (- x (/ a 2)) (- y (- d (+ c h)))))
- (setq p8_bulge (sk_2pr->bulge p8 p10 10))
- (setq p9_bulge (sk_2pr->bulge p9 p7 10))
- (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(62 . 2) '(90 . 12) '(70 . 1) (cons 10 p1) (cons 10 p2)(cons 10 p3) (cons 10 p4) (cons 10 p8)(cons 42 p8_bulge) (cons 10 p10) (cons 10 p12) (cons 10 p11) (cons 10 p9)(cons 42 p9_bulge) (cons 10 p7) (cons 10 p5) (cons 10 p6)))
- (entmake (list '(0 . "LINE") '(62 . 2) (cons 10 p5) (cons 11 p4)))
- (entmake (list '(0 . "LINE") '(62 . 2) (cons 10 p7) (cons 11 p8)))
- (princ))
|