乐筑天下

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

[综合讨论] 我怎样才能在A中绘制螺旋描记器

[复制链接]

22

主题

80

帖子

58

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
110
发表于 2022-7-7 19:32:45 | 显示全部楼层 |阅读模式
螺旋描记器,正如你们中的一些人可能知道的,是通过将一个圆滑入或滑出另一个半径不同的圆而获得的曲线。
 
还有一个用来绘制这些图形的玩具。我在一个网站上读到,也可以在电脑上画出来(http://wordsmith.org/anu/java/spirograph.html)但我没能成功。
 
我想知道有没有可能在AutoCad中编写VBA,以便在AutoCad中绘制它们?
 
如有任何评论,我们将不胜感激。
 
BR
霍什拉凡
回复

使用道具 举报

0

主题

91

帖子

92

银币

限制会员

铜币
-1
发表于 2022-7-7 19:44:01 | 显示全部楼层
你可以很容易地用环形阵列模拟它们。
 
Autocad:
 
203300egggeg0gggrgr961.png
 
 
从网站:
 
203301cjzusyyhyffyu1hj.png
 
KC公司
回复

使用道具 举报

3

主题

526

帖子

522

银币

初来乍到

Rank: 1

铜币
17
发表于 2022-7-7 19:53:10 | 显示全部楼层
Autodesk实验室有一个插件,应该可以与2007及更高版本配合使用
 
http://labs.blogs.com/its_alive_in_the_lab/2010/05/adn-plugin-of-the-month-spiro-for-autocad-now-available.html  
 
下载页面(2010年5月)http://labs.autodesk.com/utilities/adn_plugins/supported_apps/
回复

使用道具 举报

7

主题

340

帖子

338

银币

初来乍到

Rank: 1

铜币
37
发表于 2022-7-7 20:02:15 | 显示全部楼层
甚至只是一个围绕自身排列的简单圆圈:
203303p33fiwt3z333nbyq.jpg
回复

使用道具 举报

18

主题

434

帖子

422

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
94
发表于 2022-7-7 20:07:56 | 显示全部楼层
对于真实的应用程序,您需要一些程序,但对于装饰,请使用上面的array命令。
回复

使用道具 举报

18

主题

434

帖子

422

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
94
发表于 2022-7-7 20:16:16 | 显示全部楼层
我在论坛上搜索了你:http://www.cadtutor.net/forum/showthread.php?32051-有些不同。。。
不要在第一页就停止阅读。
回复

使用道具 举报

22

主题

80

帖子

58

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
110
发表于 2022-7-7 20:22:47 | 显示全部楼层
 
谢谢我会检查这些页面。
也感谢福卡罗。
回复

使用道具 举报

10

主题

973

帖子

909

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-7 20:25:36 | 显示全部楼层
这是我的尝试。It基础;需要非常具体的设置。有关布线所需的一般方向,请参阅随附文件。对于某些半径比,这个例程将受益于一些递归,但这是我可以投入的全部时间。
  1. Option Explicit
  2. Const TwoPi As Double = 3.14159265359 * 2
  3. Sub CreatePattern()
  4. Dim StationaryCircle As AcadCircle
  5. Dim RotatingCircle As AcadCircle
  6. Dim PenPoint As AcadPoint
  7. Dim tempPoint As AcadPoint
  8. Dim varPkPt As Variant
  9. Dim rotationAngle As Double
  10. Dim ent As AcadEntity
  11. Dim Origin(2) As Double
  12. Dim PenPt() As Double
  13. Dim SpiroCurve As AcadSpline
  14. Dim startTan(0 To 2) As Double
  15. Dim endTan(0 To 2) As Double
  16. Dim fitPoints(0 To 194) As Double
  17. Dim RadRatio As Double
  18. Dim vararray As Variant
  19. Dim varNewarray As Variant
  20. Dim NumOfArray As Integer
  21. Dim NumOfInitialRotations As Integer
  22. Dim Remain As Double
  23. Dim count As Integer
  24. Dim SeqBlock As AcadBlock
  25. Dim ref As AcadBlockReference
  26.   On Error Resume Next
  27.   With ThisDrawing.Utility
  28.      .GetEntity ent, varPkPt, "Select Circle at WCS origin: "
  29.      If Err <> 0 Then Exit Sub
  30.      If TypeOf ent Is AcadCircle Then
  31.         Set StationaryCircle = ent
  32.      Else: Exit Sub
  33.      End If
  34.         If Round(DistBetween2PtST(Origin, StationaryCircle.center), 6) <> 0 Then Exit Sub
  35.         
  36.      .GetEntity ent, varPkPt, "Select Circle that rotates: "
  37.      If Err <> 0 Then Exit Sub
  38.      If TypeOf ent Is AcadCircle Then
  39.         Set RotatingCircle = ent
  40.      Else: Exit Sub
  41.      End If
  42.      
  43.      If (StationaryCircle.radius + RotatingCircle.radius) - RotatingCircle.center(0) > 0.0000001 Then
  44.      .Prompt "Circles are not situated correctly! Operation Cancelled. "
  45.      Exit Sub
  46.      End If
  47.      
  48.      RadRatio = StationaryCircle.radius / RotatingCircle.radius
  49.      NumOfInitialRotations = Round(RadRatio)
  50.      Remain = RadRatio - NumOfInitialRotations
  51.      If Abs(Remain) < 0.0000001 Then
  52.         NumOfArray = 0
  53.         Remain = 0
  54.      End If
  55.          
  56.      .GetEntity ent, varPkPt, "Select Pen Point in rotating circle: "
  57.      If Err <> 0 Then Exit Sub
  58.      On Error GoTo 0
  59.      If TypeOf ent Is AcadPoint Then
  60.         Set PenPoint = ent
  61.         PenPt = PenPoint.Coordinates
  62.      Else: Exit Sub
  63.      End If
  64.      Dim i As Integer
  65.      
  66.      fitPoints(0) = PenPt(0)
  67.      fitPoints(1) = PenPt(1)
  68.      fitPoints(2) = PenPt(2)
  69.      
  70.      For i = 1 To 64
  71.         Set tempPoint = PenPoint.Copy
  72.         tempPoint.Rotate RotatingCircle.center, (TwoPi / 64) * i
  73.         tempPoint.Rotate StationaryCircle.center, (TwoPi / 64) * i * (RotatingCircle.radius / StationaryCircle.radius)
  74.         varPkPt = tempPoint.Coordinates
  75.         
  76.         fitPoints(i * 3) = varPkPt(0)
  77.         fitPoints(i * 3 + 1) = varPkPt(1)
  78.         fitPoints(i * 3 + 2) = varPkPt(2)
  79.         tempPoint.Delete
  80.      
  81.      Next
  82.      Set SeqBlock = ThisDrawing.Blocks.Add(Origin, "oneTurn")
  83.      
  84.      Set SpiroCurve = SeqBlock.AddSpline(fitPoints, startTan, endTan)
  85.      rotationAngle = (TwoPi / RadRatio)
  86.      
  87.      For i = 0 To NumOfInitialRotations - 1
  88.         Set ent = SpiroCurve.Copy
  89.         ent.Rotate Origin, rotationAngle * i
  90.      Next
  91.      Set ref = ThisDrawing.ModelSpace.InsertBlock(Origin, "oneTurn", 1, 1, 1, 0)
  92.      If Remain <> 0 Then
  93.         rotationAngle = (rotationAngle * NumOfInitialRotations) - TwoPi
  94.         NumOfArray = Floor(Abs(TwoPi / rotationAngle), 1)
  95.         For i = 0 To NumOfArray - 1
  96.            Set ent = ref.Copy
  97.            ent.Rotate Origin, rotationAngle * i
  98.         Next
  99.      End If
  100.   End With
  101. End Sub
  102. Function DistBetween2PtST(dblPt1 As Variant, dblPt2 As Variant) As Double
  103. DistBetween2PtST = Sqr((dblPt2(0) - dblPt1(0)) ^ 2 + (dblPt2(1) - dblPt1(1)) ^ 2 + (dblPt2(2) - dblPt1(2)) ^ 2)
  104. End Function
  105. Public Function Floor(ByVal X As Double, Optional ByVal Factor As Double = 1) As Double
  106. Floor = Int(X / Factor) * Factor
  107. End Function

螺旋体。图纸
203304pzxqg9vmgx5jb9ud.jpg
回复

使用道具 举报

22

主题

80

帖子

58

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
110
发表于 2022-7-7 20:39:23 | 显示全部楼层
谢谢
我会试试的。
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-5 07:03 , Processed in 0.586910 second(s), 83 queries .

© 2020-2025 乐筑天下

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