skalskibukowa 发表于 2022-7-6 21:54:30

[VBA]如何更改角度my A

大家好,
我有问题,因为我不知道如何将角度从0改为90。知道吗?
Private Sub CommandButton1_Click()

Dim objAcadDoc As AcadDocument
Dim AcadApp As AcadApplication
Set AcadApp = ThisDrawing.Application
Set objAcadDoc = AcadApp.Documents.Add
Set StartNewAutoCADfile = objAcadDoc

pi = 4 * Atn(1)

px = 50
py = 50
pz = 0


UserForm1.Hide

b = Val(TextBox2)
c = Val(TextBox3)
d = Val(TextBox4)
e = Val(TextBox5)
f = Val(TextBox6)
g = Val(TextBox7)

Dim r1(0 To 2) As Double
r1(0) = px
r1(1) = py
r1(2) = pz

r2 = ThisDrawing.Utility.PolarPoint(r1, pi, b)
r3 = ThisDrawing.Utility.PolarPoint(r2, 1 / 2 * pi, f + g + e)
r4 = ThisDrawing.Utility.PolarPoint(r3, 0, b)

ThisDrawing.ModelSpace.AddLine r1, r2
ThisDrawing.ModelSpace.AddLine r2, r3
ThisDrawing.ModelSpace.AddLine r3, r4
ThisDrawing.ModelSpace.AddLine r4, r1

Dim t1(0 To 2) As Double
t1(0) = px
t1(1) = py
t1(2) = pz + c

With ThisDrawing.Utility
t2 = .PolarPoint(t1, pi, b)
t3 = .PolarPoint(t2, 1 / 2 * pi, f)
t5 = .PolarPoint(t3, 0, b / 2)
t4 = .PolarPoint(t3, 0, b)
End With

With ThisDrawing.ModelSpace
.AddLine t1, t2
.AddLine t2, t3
.AddLine t3, t4
.AddLine t4, t1

End With

Dim y1(0 To 2) As Double
y1(0) = px
y1(1) = py + f + g
y1(2) = pz + d

With ThisDrawing.Utility
y2 = .PolarPoint(y1, pi, b)
y3 = .PolarPoint(y2, 1 / 2 * pi, e)
y4 = .PolarPoint(y3, 0, b)
End With

With ThisDrawing.ModelSpace
.AddLine y2, y3
.AddLine y3, y4
.AddLine y4, y1
.AddLine r1, t1
.AddLine r2, t2
.AddLine r3, y3
.AddLine r4, y4
.AddLine t4, y1
.AddLine t3, y2
.AddArc t5, b / 2, pi, 0
End With

   
   
End Sub
 
末端接头
页: [1]
查看完整版本: [VBA]如何更改角度my A