fangmin723 发表于 2025-5-16 13:17:15

弧形箭头绘制

本帖最后由 fangmin723 于 2025-5-20 07:37 编辑

(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)
)

wangsr 发表于 2025-5-16 14:14:06


谢谢分享
错误: 输入的字符串有缺陷
2026

寒潮大冬瓜 发表于 2025-5-16 15:37:26

很好→很棒!很好~很棒!!很好……很棒!!!

uualice2020 发表于 2025-5-16 16:05:07

谢谢分享!!!1

guosheyang 发表于 2025-5-16 17:23:32

感谢大佬分享代码!

czb203 发表于 2025-5-17 00:16:07

感谢大佬分享代码!

wjlove417 发表于 2025-5-17 09:09:34

命令是啥?

xyz002 发表于 2025-5-17 11:12:25

感谢大佬分享代码!               

jkop 发表于 2025-5-17 21:59:32

感谢分享,借鉴代码学习。
页: [1]
查看完整版本: 弧形箭头绘制