资源预览内容
第1页 / 共28页
第2页 / 共28页
第3页 / 共28页
第4页 / 共28页
第5页 / 共28页
第6页 / 共28页
第7页 / 共28页
第8页 / 共28页
第9页 / 共28页
第10页 / 共28页
亲,该文档总共28页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
VB凸轮轮廓线数控加工程序设计源代码八 附源程序 模块 Option Explicit Public ptx(3600) As Double 曲线存储点数组 Public pty(3600) As Double 由于存储最终输出的点 Public low As Double 数组下标 Public countnum As Integer 存储当前为第几段曲线输入的值 Public Const PI = 3.14159 Public area As Double 存储角度范围的值 Public sch As Double 总升程 Public tch As Double 输入曲线的推程 Public Huan As Double 坐标变换数据 Public Gao As Double Public a1 As String, a2 As String, a3 As String Public b1 As Double Public savetime As Double Public i As Double FrmView 主窗口 Option Explicit Dim j% Public bch As String, zbx As String, M As Integer, sd As String Private Sub CmbSlect_Click 选择曲线类型 Select Case CmbSlect.ListIndex Case 0 等加速运动 dengjiasu.NumStr.Text = 清空Text文本框 dengjiasu.NumEnd.Text = dengjiasu.NumH.Text = dengjiasu.NumStr.Text = area 设定default范围 dengjiasu.NumStr.Enabled = False dengjiasu.NumEnd.Enabled = True If CountAll.Caption = CountNow.Caption Then 最后一段曲线 dengjiasu.NumEnd.Text = 360 输入时,自动输入 dengjiasu.NumEnd.Enabled = False 默认值 dengjiasu.NumH.Text = -b1 End If dengjiasu.Show 1 Case 1 等速运动 dengsu.NumStr.Text = dengsu.NumEnd.Text = dengsu.NumH.Text = dengsu.NumStr.Text = area dengsu.NumStr.Enabled = False dengsu.NumEnd.Enabled = True If CountAll.Caption = CountNow.Caption Then dengsu.NumEnd.Text = 360 dengsu.NumEnd.Enabled = False dengsu.NumH.Text = -b1 End If dengsu.Show 1 Case 2 正弦加速度运动 sinx.NumStr.Text = sinx.NumEnd.Text = sinx.NumH.Text = sinx.NumStr.Text = area sinx.NumStr.Enabled = False sinx.NumEnd.Enabled = True If CountAll.Caption = CountNow.Caption Then sinx.NumEnd.Text = 360 sinx.NumEnd.Enabled = False sinx.NumH.Text = -b1 End If sinx.Show 1 Case 3 余弦加速度运动 Cosx.NumStr.Text = Cosx.NumEnd.Text = Cosx.NumH.Text = Cosx.NumStr.Text = area Cosx.NumStr.Enabled = False Cosx.NumEnd.Enabled = True If CountAll.Caption = CountNow.Caption Then Cosx.NumEnd.Text = 360 Cosx.NumEnd.Enabled = False Cosx.NumH.Text = -b1 End If Cosx.Show 1 Case 4 等减速运动 dengjiansu.NumStr.Text = dengjiansu.NumEnd.Text = dengjiansu.NumH.Text = dengjiansu.NumStr.Text = area dengjiansu.NumStr.Enabled = False dengjiansu.NumEnd.Enabled = True If CountAll.Caption = CountNow.Caption Then dengjiansu.NumEnd.Text = 360 dengjiansu.NumEnd.Enabled = False dengjiansu.NumH.Text = -b1 End If dengjiansu.Show 1 End Select End Sub Private Sub Command1_Click On Error Resume Next Static i% Dim FileSelect$ i% = i% + 1 j% = i% CommonDialog2.Action = 2 CommonDialog2.InitDir = c: FileSelect$ = CommonDialog2.FileName PicView1.Picture = PicView1.Image SavePicture PicView1.Picture, FileSelect$ End Sub Private Sub Command2_Click On Error Resume Next 推杆运动曲线图导出 Static i% Dim FileSelect$ i% = i% + 1 j% = i% CommonDialog3.Action = 2 CommonDialog3.InitDir = c: FileSelect$ = CommonDialog3.FileName PicView2.Picture = PicView2.Image SavePicture PicView2.Picture, FileSelect$ End Sub Private Sub Command3_Click NCFile_Click End Sub Private Sub Form_Load area = 0 countnum = 1 FrmView.Show frmAbout.Show frmAbout.Timer1.Interval = 250 End Sub Private Sub Frmch_Click Frmliuch.Show End Sub Private Sub NCFile_Click FrmNC.Show 1 End Sub Private Sub New_Click FrmView.InRadius.Text = 清空Frmin1窗口中文本框的数值 FrmView.InRise1.Text = FrmView.InNum.Text = low = 0 数据初始化 area = 0 b1 = 0 FrmView.PicView1.Cls 预览窗口清屏 FrmView.PicView2.Cls FrmView.PicView2.ScaleLeft = -20 初始化坐标系 FrmView.PicView2.ScaleTop = 18 FrmView.Picture1.Cls FrmView.Show FrmView.InRadius.Enabled = True FrmView.InRise1.Enabled = True FrmView.InNum.Enabled = True FrmView.qued.Enabled = True FrmView.Label5.Visible = False FrmView.CountAll.Caption = 0 FrmView.CountNow.Caption = 0 FrmView.Label18.Caption = 基本参数输入 FrmView.CmbSlect.Enabled = False PicView1.Visible = False PicView2.Visible = False Picture1.Visible = False Option6.Value = True End Sub Private Sub new1_Click New_Click End Sub Private Sub Option1_Click zbx = G90 End Sub Private Sub Option2_Click zbx = G91 End Sub Private Sub Option3_Click bch = End Sub Private Sub Option4_Click bch = G41 End Sub Private Sub Option5_Click bch = G42 End Sub Private Sub pmian_Click Command1_Click End Sub Private Sub qued_click Dim c1 As Integer, c2 As Integer, c As Integer 验证基圆半径,升程,曲线段数的输入是否为数字 If Val(InRadius) = 0 Then MsgBox (不能为空或负值,请重新输入), 16 InRadius = InRadius.SetFocus ElseIf Val(InRise1) = 0 Then MsgBox (不能为空或负值,请重新输入), 16 InRise1 = InRise1.SetFocus ElseIf Val(InNum) = 1 Then MsgBox
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号