本帖最后由 fangmin723 于 2025-5-16 13:30 编辑
 - (defun C:ArcArrow(/ arcsin arrowang arrowhig arrowlocang bulge cenrad center maxbulge minbulge pt1 pt2 pt3 pt4 size spt tan)
- (defun tan(x) (/ (sin x) (cos x)))
- (defun arcsin(x) (atan (/ x (expt (- 1 (* x x)) 0.5))))
- (if (and
- (setq center (getpoint "\n指定圆心"))
- (setq cenrad (getdist center "\n弧形箭头中心半径:"))
- (setq arrowlocang (getangle center "\n箭头放置角度:"))
- )
- (progn
- (if (not (setq size (getreal "\n箭头大小<2.5>:"))) (setq size 2.5))
- (setq arrowhig (/ size 3.0))
- (setq arrowang (/ size cenrad))
- (setq spt (polar center (- arrowlocang arrowang) cenrad))
- (setq bulge (tan (* arrowang 0.25)))
- (setq pt1 (polar center arrowlocang cenrad))
- (setq pt2 (polar center arrowlocang (- cenrad (* arrowhig 0.5))))
- (setq pt3 (polar center (+ arrowlocang arrowang) cenrad))
- (setq pt4 (polar center arrowlocang (+ cenrad (* arrowhig 0.5))))
- (setq minbulge (tan (* (Arcsin (/ (* 0.5 (distance pt2 pt3)) (- cenrad (* arrowhig 0.5)))) 0.5)))
- (setq maxbulge (tan (* (Arcsin (/ (* 0.5 (distance pt4 pt3)) (+ cenrad (* arrowhig 0.5)))) 0.5)))
- (entmake
- (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 6)
- (cons 10 spt) (cons 42 bulge)
- (cons 10 pt1)
- (cons 10 pt2) (cons 42 minbulge)
- (cons 10 pt3) (cons 42 (* -1 maxbulge))
- (cons 10 pt4)
- (cons 10 pt1)
- )
- )
- )
- )
- (prin1)
- )
|