📄 form1.vb
字号:
Imports System.Math
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写处置以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意:以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
Friend WithEvents TextBox7 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.Button1 = New System.Windows.Forms.Button()
Me.TextBox7 = New System.Windows.Forms.TextBox()
Me.TextBox5 = New System.Windows.Forms.TextBox()
Me.TextBox6 = New System.Windows.Forms.TextBox()
Me.TextBox3 = New System.Windows.Forms.TextBox()
Me.TextBox4 = New System.Windows.Forms.TextBox()
Me.TextBox2 = New System.Windows.Forms.TextBox()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.Button2 = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
Me.Label5 = New System.Windows.Forms.Label()
Me.Label6 = New System.Windows.Forms.Label()
Me.Label7 = New System.Windows.Forms.Label()
Me.CheckBox1 = New System.Windows.Forms.CheckBox()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'GroupBox1
'
Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.CheckBox1, Me.Label7, Me.Label6, Me.Label5, Me.Label4, Me.Label3, Me.Label2, Me.Label1, Me.Button2, Me.Button1, Me.TextBox7, Me.TextBox5, Me.TextBox6, Me.TextBox3, Me.TextBox4, Me.TextBox2, Me.TextBox1})
Me.GroupBox1.Location = New System.Drawing.Point(32, 16)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(328, 208)
Me.GroupBox1.TabIndex = 3
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "GroupBox1"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(56, 160)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(96, 32)
Me.Button1.TabIndex = 15
Me.Button1.Text = "Button1"
'
'TextBox7
'
Me.TextBox7.Location = New System.Drawing.Point(80, 112)
Me.TextBox7.Name = "TextBox7"
Me.TextBox7.Size = New System.Drawing.Size(56, 21)
Me.TextBox7.TabIndex = 13
Me.TextBox7.Text = "TextBox7"
'
'TextBox5
'
Me.TextBox5.Location = New System.Drawing.Point(80, 80)
Me.TextBox5.Name = "TextBox5"
Me.TextBox5.Size = New System.Drawing.Size(56, 21)
Me.TextBox5.TabIndex = 11
Me.TextBox5.Text = "TextBox5"
'
'TextBox6
'
Me.TextBox6.Location = New System.Drawing.Point(232, 80)
Me.TextBox6.Name = "TextBox6"
Me.TextBox6.Size = New System.Drawing.Size(56, 21)
Me.TextBox6.TabIndex = 9
Me.TextBox6.Text = "TextBox6"
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(80, 48)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(56, 21)
Me.TextBox3.TabIndex = 7
Me.TextBox3.Text = "TextBox3"
'
'TextBox4
'
Me.TextBox4.Location = New System.Drawing.Point(232, 48)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(56, 21)
Me.TextBox4.TabIndex = 5
Me.TextBox4.Text = "TextBox4"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(232, 17)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(56, 21)
Me.TextBox2.TabIndex = 3
Me.TextBox2.Text = "TextBox2"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(80, 16)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(56, 21)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = "TextBox1"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(176, 160)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(96, 32)
Me.Button2.TabIndex = 16
Me.Button2.Text = "Button2"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(72, 24)
Me.Label1.TabIndex = 17
Me.Label1.Text = "Label1"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(160, 16)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(72, 24)
Me.Label2.TabIndex = 18
Me.Label2.Text = "Label2"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(8, 48)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(72, 24)
Me.Label3.TabIndex = 19
Me.Label3.Text = "Label3"
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(160, 48)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(72, 24)
Me.Label4.TabIndex = 20
Me.Label4.Text = "Label4"
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(8, 80)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(72, 24)
Me.Label5.TabIndex = 21
Me.Label5.Text = "Label5"
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(160, 80)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(72, 24)
Me.Label6.TabIndex = 22
Me.Label6.Text = "Label6"
'
'Label7
'
Me.Label7.Location = New System.Drawing.Point(8, 112)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(72, 24)
Me.Label7.TabIndex = 23
Me.Label7.Text = "Label7"
'
'CheckBox1
'
Me.CheckBox1.Location = New System.Drawing.Point(168, 112)
Me.CheckBox1.Name = "CheckBox1"
Me.CheckBox1.Size = New System.Drawing.Size(120, 24)
Me.CheckBox1.TabIndex = 24
Me.CheckBox1.Text = "CheckBox1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(392, 261)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.GroupBox1})
Me.Name = "Form1"
Me.Text = "Form1"
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Dim AcadApp As AutoCAD.AcadApplication
Dim 刀具 As Object
Dim Da, D0, D1, D2, D3, D4, n1, B, C As Double '齿数结构参数
Dim Z, m, Af As Double '齿数、模数、压力角
Const Pi = 3.141592 '圆周率
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Text = "实例9齿轮结构参数化三维造型"
Me.GroupBox1.Text = ""
Me.Label1.Text = "齿数Z"
Me.Label2.Text = "模数m"
Me.Label3.Text = "压力角Af"
Me.Label4.Text = "轴径D4"
Me.Label5.Text = "齿宽B"
Me.Label6.Text = "D0"
Me.Label7.Text = "D3"
'赋初值
Me.TextBox1.Text = 40 '齿数
Me.TextBox2.Text = 6 '模数
Me.TextBox3.Text = 20 '压力角
Me.TextBox4.Text = CInt(Val(Me.TextBox1.Text) * Val(Me.TextBox2.Text) * 0.3) '轴径D4
D4 = Val(Me.TextBox4.Text)
Me.TextBox5.Text = CInt(1.2 * Val(Me.TextBox4.Text)) '齿宽B
Da = Val(Me.TextBox1.Text) * Val(Me.TextBox2.Text) + 2 * Val(Me.TextBox2.Text)
Me.TextBox6.Text = Da - 12 * Val(Me.TextBox2.Text) 'D0
Me.TextBox7.Text = 1.6 * D4 'D3
Me.CheckBox1.Text = "画腹板孔"
Me.CheckBox1.Checked = True '画腹板孔
Me.Button1.Text = "齿轮结构造型"
Me.Button2.Text = "结束"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -