《cad代码》由会员分享,可在线阅读,更多相关《cad代码(59页珍藏版)》请在金锄头文库上搜索。
1、界面及程序代码界面及程序代码界面 1界面 1 程序代码 Option ExplicitDim sbyte As IntegerPrivate Sub CommandButton1_Click()If sbyte = 1 ThenMe.HideUserForm1.ShowElseIf sbyte = 2 ThenMe.HideUserForm1.ShowElseIf sbyte = 3 ThenMe.HideUserForm1.ShowElseIf sbyte = 4 ThenMe.HideUserForm1.ShowElseIf sbyte = 5 ThenMe.HideUserForm1.S
2、howElseIf sbyte = 0 ThenMe.HideUserForm1.ShowEnd If End SubPrivate Sub CommandButton2_Click()End End SubPrivate Sub OptionButton1_Click()sbyte = 1 End SubPrivate Sub OptionButton2_Click()sbyte = 2 End SubPrivate Sub OptionButton3_Click()sbyte = 3 End SubPrivate Sub OptionButton4_Click()sbyte = 4 End
3、 SubPrivate Sub OptionButton5_Click()sbyte = 5 End SubPrivate Sub UserForm_Initialize()sbyte = 0 End Sub界面 2 界面 2 程序代码 Option ExplicitDim arKa(3, 5) As Single 工况系数Private Sub ComboBox1_Change()Select Case (ComboBox1.ListIndex)Case 0ComboBox2.ListIndex = 0Case 1ComboBox2.ListIndex = 4Case 2ComboBox2.
4、ListIndex = 9Case ElseComboBox2.ListIndex = 19End Select End SubPrivate Sub ComboBox2_Change()Select Case (ComboBox2.ListIndex)Case 0 To 3ComboBox1.ListIndex = 0Case 4 To 8ComboBox1.ListIndex = 1Case 9 To 18ComboBox1.ListIndex = 2Case ElseComboBox1.ListIndex = 3End Select End SubPrivate Sub CommandB
5、utton1_Click()Unload Me带传动设计.Show End SubPrivate Sub CommandButton2_Click()Dim xka As SingleDim i As Singlep = TextBox1.Textn1 = TextBox3.Textn2 = TextBox4.Textr = TextBox2.TextIf ComboBox5.ListIndex = 0 Then 减速传动xka = 1#ElseIf ComboBox5.ListIndex = 1 Then 增速传动i = n2 / n1If (i = 1.25 And i = 3.5 The
6、nxka = 1.28Elsexka = 1#End IfElsexka = 1.2End IfDim m As Integer, n As Integer, j As Integerm = ComboBox1.ListIndex 工况n = ComboBox3.ListIndex 启动方式j = ComboBox4.ListIndex 日工作时间Ka = arKa(m, n * 3 + j) * xkaPd = Ka * pMe.hide带型选择.Show End SubPrivate Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.Retur
7、nInteger)If (KeyAscii 57) And KeyAscii 46 ThenKeyAscii = 0End If End SubPrivate Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean)TextBox4.Text = TextBox3.Text / TextBox2.Text End SubPrivate Sub TextBox3_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)If (KeyAscii 57) And KeyAscii 46 ThenKeyA
8、scii = 0End If End SubPrivate Sub UserForm_Initialize()ComboBox1.AddItem (“载荷变动很小“)ComboBox1.AddItem (“载荷变动较小“)ComboBox1.AddItem (“载荷变动较大“)ComboBox1.AddItem (“载荷变动很大“)ComboBox2.AddItem (“液压搅拌机“)ComboBox2.AddItem (“离心式水泵和压缩机“)ComboBox2.AddItem (“通风机和鼓风机“)ComboBox2.AddItem (“轻负荷输送机“)ComboBox2.AddItem
9、(“带式输送机“)ComboBox2.AddItem (“通风机“)ComboBox2.AddItem (“螺旋式水泵和压缩机“)ComboBox2.AddItem (“发电机“)ComboBox2.AddItem (“旋转筛和木工机械“)ComboBox2.AddItem (“制砖机“)ComboBox2.AddItem (“斗式提升机“)ComboBox2.AddItem (“往复式水泵和压缩机“)ComboBox2.AddItem (“起重机“)ComboBox2.AddItem (“磨粉机“)ComboBox2.AddItem (“冲剪机床“)ComboBox2.AddItem (“橡
10、胶机械“)ComboBox2.AddItem (“振动筛“)ComboBox2.AddItem (“纺织机械“)ComboBox2.AddItem (“重在输送机“)ComboBox2.AddItem (“磨碎机(鄂式)“)ComboBox2.AddItem (“磨碎机(旋转式)“)ComboBox2.AddItem (“磨碎机(球磨)“)ComboBox2.AddItem (“磨碎机(棒磨)“)ComboBox2.AddItem (“磨碎机(管磨)“)ComboBox3.AddItem (“软启动“)ComboBox3.AddItem (“硬启动“)ComboBox4.AddItem (“1
11、6“)ComboBox5.AddItem (“减速传动“)ComboBox5.AddItem (“增速传动“)ComboBox1.ListIndex = 0ComboBox2.ListIndex = 0ComboBox3.ListIndex = 0ComboBox4.ListIndex = 0ComboBox5.ListIndex = 0TextBox1.Text = 10TextBox2.Text = 5TextBox3.Text = 1440TextBox4.Text = 288arKa(0, 0) = 1#: arKa(0, 1) = 1.1: arKa(0, 2) = 1.2: arK
12、a(0, 3) = 1.1: arKa(0, 4) = 1.2: arKa(0, 5) = 1.3arKa(1, 0) = 1.1: arKa(1, 1) = 1.2: arKa(1, 2) = 1.3: arKa(1, 3) = 1.2: arKa(1, 4) = 1.3: arKa(1, 5) = 1.4arKa(2, 0) = 1.2: arKa(2, 1) = 1.3: arKa(2, 2) = 1.4: arKa(2, 3) = 1.4: arKa(2, 4) = 1.4: arKa(2, 5) = 1.6arKa(3, 0) = 1.3: arKa(3, 1) = 1.4: arK
13、a(3, 2) = 1.5: arKa(3, 3) = 1.5: arKa(3, 4) = 1.6: arKa(3, 5) = 1.8 End Sub界面 3界面 5 程序代码 Option ExplicitDim v As Single 带速Dim i As Single 实际传动比Private Sub ComboBox1_Change()Dim adoConn As ADODB.Connection 连接对象Dim adoRs As RecordsetDim strPath As StringstrPath = ThisDrawing.Application.VBE.ActiveVBPr
14、oject.FileNameSet adoConn = New ADODB.ConnectionadoConn.CursorLocation = adUseClientadoConn.Provider = “Microsoft.ACE.OLEDB.12.0;“strPath = Left(strPath, Len(strPath) - 9) “strPath = Left(strPath, Len(strPath) - 9) “strPath = Left(strPath, Len(strPath) - 9) H2; 1 Thenp1(0) = Vf + Ve: p1(1) = ddi / 2
15、 + Vhap2(0) = Vf: p2(1) = p1(1)p3(0) = Vf / 2: p3(1) = p1(1) + 20Set dimLn = ThisDrawing.ModelSpace.AddDimAligned(p1, p2, p3)ts = “A1;H2;“p1(0) = 4: p1(1) = ddi / 2 - Vhf - Vdeltap2(0) = 4: p2(1) = -p1(1)p3(0) = -10: p3(1) = 0: p3(2) = 0Set dimLn = ThisDrawing.ModelSpace.AddDimAligned(p1, p2, p3)dim
16、Ln.TextOverride = “%c“p1(0) = 0: p1(1) = ddi / 2 + Vhap2(0) = 0: p2(1) = -1 * ddi / 2 - Vhap3(0) = -30: p3(1) = 0: p3(2) = 0Set dimLn = ThisDrawing.ModelSpace.AddDimAligned(p1, p2, p3)dimLn.TextOverride = “%cH0.75x;S+2-1“dimLn.TextOverride = tsdimLn.Update 标注 VfIf beltz 1 Thenp1(0) = 2 + Vf: p1(1) = ddi / 2p2(0) = p1(0) + Ve: p2(1) = p1(1)p3(0) = (p1(0) + p2(0) / 2: p3(1) = p1(1) + Vha + 20Set dimLn = ThisD