凸轮设计_机械原理课程设计凸轮设计 | ||
Private Sub Command1_Click()'参凸轮数初始化Dim r0%, r1%, h%, e%Dim a1%, a01%, a2%, a02%r0 = Val(InputBox("请输入基圆半径"))r1 = Val(InputBox("请输入滚子半径"))h = Val(InputBox("请输入升程"))e = Val(InputBox("请输入偏距"))a1 = Val(InputBox("请输入推程运动角"))a01 = Val(InputBox("请输入远休止角"))a2 = Val(InputBox("请输入回程运动角"))a02 = Val(InputBox("请输入近休止角"))Text1.Text = r0Text2.Text = r1Text3.Text = hText4.Text = eText5.Text = a1Text6.Text = a01Text7.Text = a2Text8.Text = a02Picture1.Scale (-75, 55)-(75, -55) '建立坐标系Picture1.Line (0, 50)-(0, -50)Picture1.Line (-55, 0)-(55, 0)'初始化参数Dim i!, j!, k!, m!, n!Dim a!, b!, c!, d!Const pi = 3.141592653Dim s#(360), s1#(360)Dim ds#(360), ds1#(360)Dim dx#(360), dy#(360)a = a1b = a1 + a01c = a1 + a01 + a2d = 360j = 0For i = 0 To a '推程段s(j) = h * ((i / a1) - Sin(2 * pi * i * pi / a1 / 180) / (2 * pi))ds(j) = h * (1 - Cos(2 * pi * i * pi / a1 / 180)) / a1ds1(j) = ds(j) / 2s1(j) = s(j) / 2 '按比例定义参数值j = j + 1Next iFor i = (a + 1) To b '远休段s(j) = hds(j) = 0ds1(j) = 0s1(j) = s(j) / 2j = j + 1Next iFor i = (b + 1) To c '回程段s(j) = h * (1 + Cos(3 * (i - 150) * pi / 180)) / 2ds(j) = -h * pi * Sin(3 * pi * (i - 150) / 180) / (2 * a2)ds1(j) = ds(j) / 2s1(j) = s(j) / 2j = j + 1Next iFor i = (c + 1) To d '近休段s(j) = 0ds(j) = 0ds1(j) = 0s1(j) = s(j) / 2j = j + 1Next i'初始化参数'Dim X0#, Y0#, X1#, Y1#, X2#, Y2#Dim X11#, Y12#, X21#, Y22#Dim e1#, r#, p#, q#, r11#Dim s0#'按比例定义参数值'e1 = e / 2r = r0 / 2r11 = r1 / 2s0 = Sqr(r ^ 2 - e1 ^ 2)For i = 1 To 360dx(i) = (ds1(i) - e) * Sin(i * pi / 180) + (s0 + s1(i)) * Cos(i * pi / 180)dy(i) = (ds1(i) - e) * Cos(i * pi / 180) - (s0 + s1(i)) * Sin(i * pi / 180)Next i'输出理论、实际轮廓线图像及坐标值'X0 = e1: Y0 = s0For g = 2 To 360m = g - 1'求理论轮廓线X2 = (s1(g) + s0) * Sin(g * pi / 180) + e1 * Cos(g * pi / 180)Y2 = (s1(g) + s0) * Cos(g * pi / 180) - e1 * Sin(g * pi / 180)X1 = (s1(m) + s0) * Sin(m * pi / 180) + e1 * Cos(m * pi / 180)Y1 = (s1(m) + s0) * Cos(m * pi / 180) - e1 * Sin(m * pi / 180)Picture1.Line (X0, Y0)-(X1, Y1) '输出理论轮廓线图Picture1.Line (X1, Y1)-(X2, Y2)'求实际轮廓线p = dx(m) / Sqr(dx(m) ^ 2 + dy(m) ^ 2)q = -dy(m) / Sqr(dx(m) ^ 2 + dy(m) ^ 2)p1 = dx(g) / Sqr(dx(g) ^ 2 + dy(g) ^ 2)q1 = -dy(g) / Sqr(dx(g) ^ 2 + dy(g) ^ 2)X11 = X1 - r11 * qY12 = Y1 - r11 * pX21 = X2 - r11 * q1Y22 = Y2 - r11 * p1Picture1.PSet (X11, Y12) '输出实际轮廓线图Text9.Text = Text9.Text & " " & m & " " & 2 * X1 & " " & 2 * Y1 & " " & 2 * X11 & " " & 2 * Y12 & " " & vbCrLf '输出理论、实际轮廓线坐标值X0 = X2: Y0 = Y2Next gEnd Sub。 |
||
上一个:凸轮轴 下一个:凸轮机构 |