明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 442|回复: 8

[基础] 弧形箭头绘制

  [复制链接]
发表于 前天 13:17 | 显示全部楼层 |阅读模式
本帖最后由 fangmin723 于 2025-5-16 13:30 编辑
  1. (defun C:ArcArrow(/ arcsin arrowang arrowhig arrowlocang bulge cenrad center maxbulge minbulge pt1 pt2 pt3 pt4 size spt tan)
  2.   (defun tan(x) (/ (sin x) (cos x)))
  3.   (defun arcsin(x) (atan (/ x (expt (- 1 (* x x)) 0.5))))
  4.   (if (and
  5.         (setq center (getpoint "\n指定圆心"))
  6.         (setq cenrad (getdist center "\n弧形箭头中心半径:"))
  7.         (setq arrowlocang (getangle center "\n箭头放置角度:"))
  8.       )
  9.     (progn
  10.       (if (not (setq size (getreal "\n箭头大小<2.5>:"))) (setq size 2.5))
  11.       (setq arrowhig (/ size 3.0))
  12.       (setq arrowang (/ size cenrad))
  13.       (setq spt (polar center (- arrowlocang arrowang) cenrad))
  14.       (setq bulge (tan (* arrowang 0.25)))
  15.       (setq pt1 (polar center arrowlocang cenrad))
  16.       (setq pt2 (polar center arrowlocang (- cenrad (* arrowhig 0.5))))
  17.       (setq pt3 (polar center (+ arrowlocang arrowang) cenrad))
  18.       (setq pt4 (polar center arrowlocang (+ cenrad (* arrowhig 0.5))))
  19.       (setq minbulge (tan (* (Arcsin (/ (* 0.5 (distance pt2 pt3)) (- cenrad (* arrowhig 0.5)))) 0.5)))
  20.       (setq maxbulge (tan (* (Arcsin (/ (* 0.5 (distance pt4 pt3)) (+ cenrad (* arrowhig 0.5)))) 0.5)))
  21.       (entmake
  22.         (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 6)
  23.           (cons 10 spt) (cons 42 bulge)
  24.           (cons 10 pt1)
  25.           (cons 10 pt2) (cons 42 minbulge)
  26.           (cons 10 pt3) (cons 42 (* -1 maxbulge))
  27.           (cons 10 pt4)
  28.           (cons 10 pt1)
  29.         )
  30.       )
  31.     )
  32.   )
  33.   (prin1)
  34. )

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x

评分

参与人数 1明经币 +1 收起 理由
USER2128 + 1 赞一个!

查看全部评分

"觉得好,就打赏"
还没有人打赏,支持一下
回复

使用道具 举报

发表于 前天 14:14 | 显示全部楼层

谢谢分享
错误: 输入的字符串有缺陷
2026
回复 支持 反对

使用道具 举报

发表于 前天 15:37 | 显示全部楼层
很好→很棒!很好~很棒!!很好……很棒!!!
回复 支持 反对

使用道具 举报

发表于 前天 17:23 | 显示全部楼层
感谢大佬分享代码!
回复 支持 反对

使用道具 举报

发表于 昨天 00:16 | 显示全部楼层
感谢大佬分享代码!
回复 支持 反对

使用道具 举报

发表于 昨天 11:12 | 显示全部楼层
感谢大佬分享代码!               
回复 支持 反对

使用道具 举报

发表于 昨天 21:59 | 显示全部楼层
感谢分享,借鉴代码学习。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-18 09:29 , Processed in 0.180800 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表