乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 83|回复: 13

[综合讨论] 限制圆弧的AutoLISP命令

[复制链接]

2

主题

15

帖子

13

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 23:32:42 | 显示全部楼层 |阅读模式
您好,我正在寻找一种限制圆弧长度的方法(使用AutoLISP),该圆弧沿x轴有一个设定的中心点和一个设定的半径?
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 23:41:04 | 显示全部楼层
不知道你想要什么,需要一张照片。如果弧小于359.99999度,则弧不是圆
回复

使用道具 举报

2

主题

15

帖子

13

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 23:43:00 | 显示全部楼层

                               
登录/注册后可看大图

红线是要删除的部分,黄色弧的长度需要受到吹扫CM的限制,其中弧的半径为弧垂。
此外,出现的两条白线不会出现在最终脚本中。
我已经在下面发布了我的脚本。
  1. ;; Sets the initiating command to "TEST"
  2. (defun C:TEST()
  3. ;; Sets the pre-defined values for blow-off
  4. (setq d 0.0211)
  5. (setq F 0.63)
  6. (setq T 1878)
  7. ;; Sets the variables for blow-off
  8. (setq Vw (getreal "\n Enter the Windspeed (m/s):"))
  9. (setq L (getreal "\n Enter the Span-length (m):"))
  10. ;; Calculates the Blow-off in (m)
  11. (setq multiply1 (* (* Vw Vw) (* L L)))
  12. (setq multiply2 (* d F))
  13. (setq BLOWOFFm1 (* multiply1 multiply2))
  14. (setq BLOWOFFm (/ BLOWOFFm1 (* 8 T)))
  15. ;; Sets pre-defined values for sag
  16. (setq V 7.159)
  17. (setq t 1878)
  18. ;; Sets the variables for sag
  19. (setq S (getreal "\n Enter the height at the start of the span (m):"))
  20. (setq E (getreal "\n Enter the height at the end of the span (m):"))
  21. (setq As L)
  22. ;; Calculates position of low point in span
  23. (setq P (- (/ As 2) (* t (/ (- E S) (* V As)))))
  24. ;; Calculates the wire sag (m)
  25. (setq sag1 (/ (* V (EXPT P 2.0)) (* 2 t)))
  26. ;; Converts wire sag into (cm)
  27. (setq sag (* sag1 100))
  28. ;; Converts BLOWOFFm onto (cm)
  29. (setq BLOWOFFcm (* BLOWOFFm 100))
  30. ;; Asks the user to select the original wire location
  31. (setq originalwire (getpoint "\n Select the original wire location:"))
  32. ;; Sets temporary points for blow-off
  33. (setq temp1 (polar originalwire 4.7123889803846898576939650749193 sag))
  34. ;; Draws clearance circle for originalwire
  35. (command "_CIRCLE" originalwire (/ d 2))
  36. ;; Creates points for arc based on blowoff and sag
  37. (setq arcpointmiddle (polar temp1 1.5707963267948966192313216916398 BLOWOFFcm))
  38. (setq arcpointright (polar arcpointmiddle 0.0 BLOWOFFcm))
  39. (setq arcpointleft (polar arcpointmiddle 3.1415926535897932384626433832795 BLOWOFFcm))
  40. ;; Linetype load
  41. (defun ltype_set (ltname)
  42. (if (not (tblsearch "LTYPE" ltname)) ;; Check to see if the linetype exists
  43. (if (findfile "acad.lin")
  44. (command "._LINETYPE" "._LOAD" ltname "acad.lin" "") ;; Load the linetype if it is found
  45. (setq ltname "Continuous") ;; If not, set the linetype to Continuous
  46. )
  47. )
  48. )
  49. ;; Creates a new layer for the clearnace to be placed on after checking if the layer already exists
  50. (defun layer_set (lyr col ltname)
  51. (if (tblsearch "LAYER" lyr) ;; Check to see if the layer exists
  52. (command "._LAYER" "_THAW" lyr "_UNLOCK" lyr "_ON" lyr "_SET" lyr "") ;; If layer exists, set it current
  53. ;; If the layer doesn't exist, make this layer
  54. (if (tblsearch "LTYPE" ltname) ;; If linetype doesn't exist
  55. (command "._LAYER" "_MAKE" lyr "_COLOUR" col lyr "_LT" ltname lyr "")
  56. (command "._LAYER" "_MAKE" lyr "_COLOUR" col lyr "_LT" "Continuous" lyr "")
  57. )
  58. )
  59. )
  60. ;; Draws arc from arcpointright to arcpointleft through arcpointmiddle on the new layer
  61. (layer_set "Continuous" "50" "DASHDOT")
  62. (command "._CIRCLE" originalwire sag)
  63. ;(command "._ARC" arcpointleft arcpointmiddle arcpointright)
  64. ;; Reset layer back to "0"
  65. (layer_set "0" "7" "Continuous")
  66. ;; Draws clearance circles for left, right and middle arcpoints
  67. (command "_CIRCLE" temp1 (/ d 2))
  68. (command "_CIRCLE" arcpointleft (/ d 2))
  69. (command "_CIRCLE" arcpointright (/ d 2))
  70. ;; Draws lines for trim
  71. (setq line1 (polar arcpointleft 4.7123889803846898576939650749193 BLOWOFFcm))
  72. (command "._LINE" arcpointleft line1 "")
  73. (setq line2 (polar arcpointright 4.7123889803846898576939650749193 BLOWOFFcm))
  74. (command "._LINE" arcpointright line2 "")
  75. ;; Creates a text box containing the BLOWOFFcm value
  76. (setq text3 (getpoint "\n Pick the first point for the dimension box:"))
  77. (setq text4 (getpoint "\n Pick the second point for the dimension box:"))
  78. (command "_.MTEXT" text3 text4 "Blow-off (cm) =" BLOWOFFcm "")
  79. ;; Creates a text box containing the Sag value
  80. (setq text5 (getpoint "\n Pick the first point for the dimension box:"))
  81. (setq text6 (getpoint "\n Pick the second point for the dimension box:"))
  82. (command "_.MTEXT" text5 text6 "Sag (cm) =" sag "")
  83. ;; Trims the excess circle
  84. (command "._TRIM" "")
  85. (princ)
  86. )

 
此外,如何在黄色弧的每一端创建一个附加点?
 
谢谢你的帮助
003251possokyusosk7fxe.png
回复

使用道具 举报

17

主题

1274

帖子

25

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
260
发表于 2022-7-6 23:48:17 | 显示全部楼层
我试着让你口齿不清,但仍然不确定你想做什么。与其画一个圆并修剪它,为什么不画一个弧呢?由于弧垂²-吹扫cm²=dy²,吹扫cm/sag=½弧角的余弦,因此绘制弧和端点应该足够简单。
回复

使用道具 举报

2

主题

15

帖子

13

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 23:53:55 | 显示全部楼层
我曾尝试使用两点创建圆弧,但有一个问题,即没有弧垂作为半径。(我已经从代码中删除了它,因为它开始破坏它,我想使用一个圆并修剪它)
  1. ;; Draws arc from arcpointright to arcpointleft through arcpointmiddle on the new layer
  2. (layer_set "Continuous" "50" "DASHDOT")
  3. (command "._CIRCLE" originalwire sag)
  4. ;(command "._ARC" arcpointleft arcpointmiddle arcpointright)

 
我真的不确定我该如何实施你的建议,因为你的等式让我有点困惑
回复

使用道具 举报

17

主题

1274

帖子

25

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
260
发表于 2022-7-6 23:57:22 | 显示全部楼层
arcpointleft、arcpointmiddle和arcpointright点不构成弧。尝试使用
在图形中的这些点之间放置一条线,以查看它们是否构成一条直线。不能用三个点绘制一条直线。也没有一个是圆。如果正确计算这些点,Arc命令将起作用。因为BLOWOFFcm是端点的dx,我展示了如何得到端点的dy,首先你要做的是从原始导线的x值减去弧垂值,得到弧点中点。
回复

使用道具 举报

2

主题

15

帖子

13

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-7 00:02:27 | 显示全部楼层
这是有道理的。我现在就开始实施,看看进展如何。
回复

使用道具 举报

2

主题

15

帖子

13

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-7 00:05:34 | 显示全部楼层
谢谢tombu!
 
我如何使底弧与3个圆相切?我可以在中间圆圈的底部设置一个点,但两边的两个呢?
 

                               
登录/注册后可看大图

 
我是通过以下方式在图片中完成的:
  1. ;; Draws arc from arcpointright to arcpointleft through arcpointmiddle on the new layer
  2. (layer_set "Continuous" "50" "DASHED")
  3. (command "._ARC" arcpointleft arcpointmiddle arcpointright "")
  4. ;; Sets another set of points for the clearance arc
  5. (setq clearancearcmiddle (polar arcpointmiddle 4.7123889803846898576939650749193 66))
  6. (setq clearancearcleft (polar arcpointleft 4.7123889803846898576939650749193 66))
  7. (setq clearancearcright (polar arcpointright 4.7123889803846898576939650749193 66))
  8. ;; Draws clearance arc
  9. (command "._ARC" clearancearcleft clearancearcmiddle clearancearcright)

003256aogq0mcgcuiaqbnz.png
回复

使用道具 举报

17

主题

1274

帖子

25

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
260
发表于 2022-7-7 00:11:57 | 显示全部楼层
假设这三个圆的半径相同,只需将第一个圆弧偏移该量即可。我将使用entget实体列表数据生成另一条弧,该数据来自具有修改半径的第一条弧。查看圆弧图元的DXF组码。正如我所记得的,你需要做的是弧的中心点,半径,开始角度和结束角度。
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-7 00:18:21 | 显示全部楼层
(setq Pi270(*1.5 pi))=4.171238898
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-10 05:04 , Processed in 0.399667 second(s), 74 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表