乐筑天下

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

[编程交流] [VBA]如何更改角度my A

[复制链接]

2

主题

4

帖子

2

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 21:54:30 | 显示全部楼层 |阅读模式
大家好,
我有问题,因为我不知道如何将角度从0改为90。知道吗?
  1. Private Sub CommandButton1_Click()
  2. Dim objAcadDoc As AcadDocument
  3. Dim AcadApp As AcadApplication
  4. Set AcadApp = ThisDrawing.Application
  5. Set objAcadDoc = AcadApp.Documents.Add
  6. Set StartNewAutoCADfile = objAcadDoc
  7. pi = 4 * Atn(1)
  8. px = 50
  9. py = 50
  10. pz = 0
  11. UserForm1.Hide
  12. b = Val(TextBox2)
  13. c = Val(TextBox3)
  14. d = Val(TextBox4)
  15. e = Val(TextBox5)
  16. f = Val(TextBox6)
  17. g = Val(TextBox7)
  18. Dim r1(0 To 2) As Double
  19. r1(0) = px
  20. r1(1) = py
  21. r1(2) = pz
  22. r2 = ThisDrawing.Utility.PolarPoint(r1, pi, b)
  23. r3 = ThisDrawing.Utility.PolarPoint(r2, 1 / 2 * pi, f + g + e)
  24. r4 = ThisDrawing.Utility.PolarPoint(r3, 0, b)
  25. ThisDrawing.ModelSpace.AddLine r1, r2
  26. ThisDrawing.ModelSpace.AddLine r2, r3
  27. ThisDrawing.ModelSpace.AddLine r3, r4
  28. ThisDrawing.ModelSpace.AddLine r4, r1
  29. Dim t1(0 To 2) As Double
  30. t1(0) = px
  31. t1(1) = py
  32. t1(2) = pz + c
  33. With ThisDrawing.Utility
  34. t2 = .PolarPoint(t1, pi, b)
  35. t3 = .PolarPoint(t2, 1 / 2 * pi, f)
  36. t5 = .PolarPoint(t3, 0, b / 2)
  37. t4 = .PolarPoint(t3, 0, b)
  38. End With
  39. With ThisDrawing.ModelSpace
  40. .AddLine t1, t2
  41. .AddLine t2, t3
  42. .AddLine t3, t4
  43. .AddLine t4, t1
  44. End With
  45. Dim y1(0 To 2) As Double
  46. y1(0) = px
  47. y1(1) = py + f + g
  48. y1(2) = pz + d
  49. With ThisDrawing.Utility
  50. y2 = .PolarPoint(y1, pi, b)
  51. y3 = .PolarPoint(y2, 1 / 2 * pi, e)
  52. y4 = .PolarPoint(y3, 0, b)
  53. End With
  54. With ThisDrawing.ModelSpace
  55. .AddLine y2, y3
  56. .AddLine y3, y4
  57. .AddLine y4, y1
  58. .AddLine r1, t1
  59. .AddLine r2, t2
  60. .AddLine r3, y3
  61. .AddLine r4, y4
  62. .AddLine t4, y1
  63. .AddLine t3, y2
  64. .AddArc t5, b / 2, pi, 0
  65. End With
  66.    
  67.    
  68. End Sub

 
末端接头
225432xc0vi11yzpyyvdyr.jpg
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 13:54 , Processed in 0.507240 second(s), 57 queries .

© 2020-2025 乐筑天下

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