人人文库网 > 毕业设计 > 毕业论文 > GSK928数控车削仿真系统的研究与开发NC代码插补功能的设计【优秀机械机电毕业设计论文】【A6311】
GSK928数控车削仿真系统的研究与开发NC代码插补功能的设计【优秀机械机电毕业设计论文】【A6311】
收藏
资源目录
压缩包内文档预览:(预览前20页/共187页)
编号:981427
类型:共享资源
大小:573.17KB
格式:RAR
上传时间:2017-01-11
上传人:木***
认证信息
个人认证
高**(实名认证)
江苏
IP属地:江苏
50
积分
- 关 键 词:
-
gsk928
数控
车削
仿真
系统
研究
钻研
开发
nc
代码
功能
设计
优秀
优良
机械
机电
电机
毕业设计
论文
a6311
- 资源描述:
-
文档包括:
说明书一份。40页,20300字。
任务书一份。
开题报告一份。
源程序一份。

- 内容简介:
-
基于VB的数控车削仿真系统研究与开发Public fangshi As Integer 加工方式Public CODE1, CODE2, CODE3, CODE4, CODE5, CODE6, CODE7, CODE8 As Integer 定义中间变量Public CODE9, CODE10, CODE11, CODE12, CODE13, CODE14, CODE15 As Integer 定义中间变量Public dataS As Single S数值Public dataI As Single i数值Public dataK As Single k数值Public dataR As Single r数值Public dataF As Single f数值Public dataP As Single p数值Public DataX As Single x数值Public DataZ As Single z数值Public ZiChengXu As String 子程序名Public xmbz As Single X增量Public zmbz As Single Z增量Public imbz As Single I增量Public kmbz As Single K增量Public pdgs As Single F=XiZe-XeZiPublic zdpd As Integer 插补总步数Public ni As Integer 字符行Public JXS As Single IPublic JZS As Single KPublic zdyxbz As Boolean 自动运行标志Public cankaodian As Boolean 回参考点Public chaocjc As Boolean 超程Public ZouDaoX As Single 自动X走刀量Public ZouDaoZ As Single 自动Z走刀量Public ZouDao As Single 手动X、Z走刀量Public duandianbz As Single 断点标志Public chengxubz As Integer 程序标志Public djian As Integer 装卸顶尖Public Asii As Integer 输入地址判断Public jingeibeilv As Single 进给倍率Public JGBLBH As Integer 进给率变换参数Public JGpanduan As Integer 进给率判断参数Public jingeilvbh As Boolean 自动进给率变换判断(还没有运行时)参数和进给率变换标志Public dingjian As Boolean 进给率变换标志Public G04CanShu As Integer G04参数Public G96CanShu As Single G96/97参数Public G97CanShu As Single G96/97参数Public dataSii As Single dataS过渡变量Public LIMS As Single LIMS变量最高转速限制Public wenjiani, xinchengxu, XCXI, mm, anniu As Integer 新程序,文件名,文件选择Public richi, labeli, jjkk, kkjj, Shift As Integer jjkk向上翻与kkjj向左翻判断参数Public zifucs As String 字符参数MDIForm1:Public suofang As Integer 缩放按钮Private Sub chengxu01_Click() 导入程序01Form7.ShowForm7.Enabled = TrueEnd SubPrivate Sub chengxu02_Click() 导入程序Form7.ShowForm7.Enabled = TrueEnd SubPrivate Sub chengxu03_Click() 导入程序Form7.ShowForm7.Enabled = TrueEnd SubPrivate Sub chengxu04_Click() 导入程序Form7.ShowForm7.Enabled = TrueEnd SubPrivate Sub chengxu05_Click() 导入程序Form7.ShowForm7.Enabled = TrueEnd SubPrivate Sub chuangti_Click(Index As Integer)MsgBox 主窗体MDIForm1为加工模拟显示区;子窗体Form1为程序运行区;子窗体Form2为控制区;子窗体Form3为软件简介区;子窗体Form4为刀具刀位选择区;子窗体Form5为工件装夹区;子窗体Form6为启动封面区;子窗体Form7为导入程序区。, 0, 提示:End SubPrivate Sub mokuai_Click(Index As Integer)MsgBox 定义了“fangshi(方式)”,“dataX(X值)”,“zdyxbz(自动运行标志)”等全局变量。, 0, 提示:End SubPrivate Sub Timer11_Timer() 水滴滴水动画Static Sss As IntegerSelect Case SssCase 0 UserC1.Visible = True UserC2.Visible = True UserC4.Visible = True UserC3.Visible = False UserC5.Visible = False UserC6.Visible = False Sss = 1Case 1 UserC3.Visible = True UserC5.Visible = True UserC6.Visible = True UserC1.Visible = False UserC2.Visible = False UserC4.Visible = False Sss = 0End SelectEnd SubPrivate Sub yonghukongjian_Click(Index As Integer)MsgBox 定义了“UserC11(粗车刀)”,“UserC31(螺纹刀)”,“UserC51(精车刀)”,“UserC71(切刀)”等用户控件。, 0, 提示:End SubPrivate Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) 标准工具栏(点击)Select Case Button.KeyCase 新建 Form1.Show Form1.Visible = True Form1.Picture8.Visible = False For anniu = 0 To 9 Form1.Command11(anniu).Visible = False Next anniu For anniu = 10 To 14 Form1.Command11(anniu).Visible = True Next anniu For anniu = 15 To 19 Form1.Command11(anniu).Visible = False Next anniu Form1.Label13.Caption = 打开 Form1.Label14.Caption = 新程序 Form1.Label15.Caption = 删除 Form1.Label16.Caption = 改名 Form1.Label17.Caption = 关闭 Form1.Label35.Visible = False Form1.Label36.Visible = True jjkk = 0 Form1.Picture9.Visible = True Form1.RichTB(0).Visible = False Form1.RichTB(1).Visible = False For anniu = 0 To 4 Form1.RichTB1(anniu).Visible = False Next anniu Form1.Picture8.Visible = False Select Case XCXI Case 0 xinchengxu = 0 XCXI = XCXI + 1 Case 1 xinchengxu = 1 XCXI = XCXI + 1 Case 2 xinchengxu = 2 XCXI = XCXI + 1 Case 3 xinchengxu = 3 XCXI = XCXI + 1 Case 4 xinchengxu = 4 XCXI = 0 End Select Form1.Text5.Text = Form1.Text5.SetFocus 新建程序名输入获得焦点 Asii = 0Case 打开 Form1.Show Form1.Visible = True Form1.Picture9.Visible = False For anniu = 0 To 4 Form1.Command11(anniu).Visible = True Next anniu For anniu = 5 To 24 Form1.Command11(anniu).Visible = False Next anniu Form1.Label13.Caption = Form1.Label14.Caption = 程序检验 Form1.Label15.Caption = 程序 Form1.Label16.Caption = Form1.Label17.Caption = 选择 Form1.Label35.Visible = True kkjj = 1 Form1.Picture8.Visible = True Form1.RichTB(0).Visible = False Form1.RichTB(1).Visible = False For richi = 0 To 4 Form1.RichTB1(richi).Visible = False Next richiCase 菜单 Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 刀架回参考点前的坐标值 Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 直径 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = Format(Form1.Text2.Text, #0.000)If zhukongmb.Checked = False Then Form1.Show Form1.Visible = True Form2.Show Form2.Visible = True zhukongmb.Checked = True cikongmb.Checked = True Else: zhukongmb.Checked = False Form1.Visible = False Form2.Visible = False zhukongmb.Checked = False cikongmb.Checked = False End IfCase 次菜单 If zhukongmb.Checked = True And cikongmb.Checked = True Then zhukongmb.Checked = False Form1.Visible = False cikongmb.Checked = True Form2.Show Form2.Visible = True ElseIf cikongmb.Checked = True And zhukongmb.Checked = False Then zhukongmb.Checked = True Form1.Visible = True cikongmb.Checked = False Form2.Visible = False ElseIf zhukongmb.Checked = True And cikongmb.Checked = False Then zhukongmb.Checked = False Form1.Visible = False cikongmb.Checked = True Form2.Visible = True Else zhukongmb.Checked = False cikongmb.Checked = False Form1.Visible = False Form2.Visible = False End IfCase 加工区 If gongjianjgq.Checked = True Then Picture2.BorderStyle = 0 UCkp52.Visible = False gongjianjgq.Checked = False Else: gongjianjgq.Checked = True Picture2.BorderStyle = 1 UCkp52.Visible = True If Val(Form5.Text1.Text) 0 Then UCkp52.Left = (Val(Form5.Text2.Text) - 20) * 50 - 220 工件坐标系显示 UCkp52.Top = Val(Form5.Text1.Text) / 2 * 50 - 300 Else UCkp52.Left = (Val(Form5.Text5.Text) - 20) * 50 - 220 UCkp52.Top = Val(Form5.Text3.Text) / 2 * 50 - 300 End If End IfCase 对刀 Form1.Show Form1.Picture10(0).Visible = True For anniu = 0 To 14 Form1.Command11(anniu).Visible = False Next anniu For anniu = 15 To 19 Form1.Command11(anniu).Visible = True Next anniu For anniu = 20 To 24 Form1.Command11(anniu).Visible = False Next anniuForm1.Label13.Caption = 复位刀沿Form1.Label14.Caption = Form1.Label16.Caption = Form1.Label17.Caption = 对刀Case 刀具箱 Form4.Visible = TrueCase 装夹工件 Form5.Visible = True Form5.Timer1.Enabled = True TEXT6文本显示 If Form5.Text1.Text 0.00 Then Form5.Text1.SetFocus 输入获得焦点 ElseIf Form5.Text4.Text 0.00 Then Form5.Text4.SetFocus 输入获得焦点 End IfCase 顶尖 dingjian = True 顶尖应用判断 If Form5.Text1.Text = 0.00 Then Form1.Label4.Caption = 顶尖装夹错误! Form1.Label39.Caption = 顶尖装夹错误!轴的直径不能为“0”或孔类工件不能装夹 Exit Sub Else: Form1.Label4.Caption = 运行正常! Form1.Label39.Caption = 运行正常! End If Select Case djian Case 0 MDIForm1.UserControl11.Top = Val(Form5.Text1.Text) * 50 / 2 - 625 MDIForm1.UserControl11.Left = Val(Form5.Text6.Text) * 50 + 3000 Form2.Picture8.BackColor = &H80FF80 Form2.Timer12.Enabled = True djian = djian + 1 Case 1 MDIForm1.UserControl11.Top = Val(Form5.Text1.Text) * 50 / 2 - 625 MDIForm1.UserControl11.Left = Val(Form5.Text6.Text) * 50 - 300 Form2.Picture8.BackColor = &H8000& Form2.Timer13.Enabled = True Form2.Timer14.Enabled = False MDIForm1.UserControl21.Visible = False djian = 0 End Select MDIForm1.UserControl11.Visible = True Case 放大 If Picture2.Height 500 Then Picture2.Height = Picture2.Height - 500 Picture2.Width = Picture2.Width - 500 End If Case 缩放 Select Case suofang Case 0 Timer9.Enabled = True suofang = 1 Case 1 Timer9.Enabled = False suofang = 2 Case 2 Timer10.Enabled = True suofang = 3 Case 3 Timer10.Enabled = False suofang = 0 End Select Case 拖动 End SelectEnd SubPrivate Sub Timer9_Timer() 缩小 Picture2.Height = Picture2.Height - 100 Picture2.Width = Picture2.Width - 100 If Picture2.Height 13000 Then Timer10.Enabled = False End IfEnd SubPrivate Sub zhukongmb_Click() 主控面板显示If zhukongmb.Checked = False Thenzhukongmb.Checked = TrueForm1.ShowElse: zhukongmb.Checked = FalseUnload Form1End IfEnd SubPrivate Sub biaozhungjl_Click() 标准工具栏显示If biaozhungjl.Checked = False Thenbiaozhungjl.Checked = TrueToolbar1.Visible = TrueElse: biaozhungjl.Checked = FalseToolbar1.Visible = FalseEnd IfEnd SubPrivate Sub cikongmb_Click() 次控面板显示If cikongmb.Checked = False Thencikongmb.Checked = TrueForm2.ShowElse: cikongmb.Checked = FalseUnload Form2End IfEnd SubPrivate Sub tuichu_Click() 退出下拉菜单MDIForm1.Visible = FalseForm1.Visible = FalseForm2.Visible = FalseForm3.Visible = FalseForm4.Visible = FalseForm5.Visible = FalseEnd SubPrivate Sub xinjian_Click() 新建程序菜单Form1.ShowForm1.Visible = True For anniu = 0 To 9 Form1.Command11(anniu).Visible = False Next anniu For anniu = 10 To 14 Form1.Command11(anniu).Visible = True Next anniu For anniu = 15 To 19 Form1.Command11(anniu).Visible = False Next anniu Form1.Label13.Caption = 打开 Form1.Label14.Caption = 新程序 Form1.Label15.Caption = 删除 Form1.Label16.Caption = 改名 Form1.Label17.Caption = 关闭 Form1.Label35.Visible = False Form1.Label36.Visible = True jjkk = 0 Form1.Picture8.Visible = False Form1.Picture9.Visible = True Form1.RichTB(0).Visible = False Form1.RichTB(1).Visible = False For anniu = 0 To 4 Form1.RichTB1(anniu).Visible = False Next anniu Form1.Picture8.Visible = False Select Case XCXI Case 0 xinchengxu = 0 XCXI = XCXI + 1 Case 1 xinchengxu = 1 XCXI = XCXI + 1 Case 2 xinchengxu = 2 XCXI = XCXI + 1 Case 3 xinchengxu = 3 XCXI = XCXI + 1 Case 4 xinchengxu = 4 XCXI = 0 End Select Form1.Text5.Text = Form1.Text5.SetFocus 新建程序名输入获得焦点 Asii = 0End SubPrivate Sub dakai_Click() 打开菜单Form1.ShowForm1.Visible = TrueFor anniu = 0 To 4 Form1.Command11(anniu).Visible = True Next anniu For anniu = 5 To 24 Form1.Command11(anniu).Visible = False Next anniu Form1.Label13.Caption = Form1.Label14.Caption = 程序检验 Form1.Label15.Caption = 程序 Form1.Label16.Caption = Form1.Label17.Caption = 选择 Form1.Label35.Visible = True kkjj = 1 Form1.Picture8.Visible = True Form1.Picture9.Visible = False Form1.RichTB(0).Visible = False Form1.RichTB(1).Visible = False For richi = 0 To 4 Form1.RichTB1(richi).Visible = False Next richiEnd SubPrivate Sub gongjianjgq_Click() 工件加工区域显示 If gongjianjgq.Checked = True Then Picture2.BorderStyle = 0 UCkp52.Visible = False gongjianjgq.Checked = False Else: gongjianjgq.Checked = True Picture2.BorderStyle = 1 UCkp52.Visible = True If Val(Form5.Text1.Text) 0 Then UCkp52.Left = (Val(Form5.Text2.Text) - 20) * 50 - 220 工件坐标系显示 UCkp52.Top = Val(Form5.Text1.Text) / 2 * 50 - 300 Else UCkp52.Left = (Val(Form5.Text5.Text) - 20) * 50 - 220 UCkp52.Top = Val(Form5.Text3.Text) / 2 * 50 - 300 End If End IfEnd SubPrivate Sub guanyu_Click() 帮助-关于Form3.ShowForm3.Text1.Text = 西门子数控车仿真软件(XMZFZ-01A)是针对SIENMENS 802S数控系统而设计与开发的。End SubPrivate Sub MDIForm_Load() 工具栏加载biaozhungjl.Checked = Truegongjianjgq.Checked = Falsezdyxbz = Falsejingeilvbh = Falsechaocjc = Falsecankaodian = FalseG96CanShu = 1 恒线速初始量LIMS = 5000 机床最高转速限制End SubPrivate Sub Timer1_Timer() 卡盘正转Static i As IntegerSelect Case iCase 0UCkp11.Visible = TrueUCkp21.Visible = FalseUCkp31.Visible = FalseUCkp41.Visible = TrueUCkp51.Visible = Falsei = i + 1Case 1UCkp11.Visible = FalseUCkp21.Visible = TrueUCkp31.Visible = FalseUCkp41.Visible = FalseUCkp51.Visible = Truei = i + 1Case 2UCkp11.Visible = TrueUCkp21.Visible = FalseUCkp31.Visible = TrueUCkp41.Visible = FalseUCkp51.Visible = Truei = 0End SelectIf dingjian = True Then 顶尖应用判断 If MDIForm1.UserControl11.Left = Val(Form5.Text6.Text) * 50 - 300 Then 如果顶上工件 Form2.Timer14.Enabled = True 顶尖旋转 Else: Form2.Timer14.Enabled = False End If Else: Form2.Timer14.Enabled = False 如果顶尖按钮没按动则顶尖不旋转End IfEnd SubPrivate Sub Timer2_Timer() 卡盘反转Static j As IntegerSelect Case jCase 0UCkp11.Visible = FalseUCkp21.Visible = TrueUCkp31.Visible = FalseUCkp41.Visible = FalseUCkp51.Visible = Truej = j + 1Case 1UCkp11.Visible = TrueUCkp21.Visible = FalseUCkp31.Visible = FalseUCkp41.Visible = TrueUCkp51.Visible = Falsej = j + 1Case 2UCkp11.Visible = TrueUCkp21.Visible = FalseUCkp31.Visible = TrueUCkp41.Visible = FalseUCkp51.Visible = Truej = 0End SelectIf dingjian = True Then 顶尖应用判断 If MDIForm1.UserControl11.Left = Val(Form5.Text6.Text) * 50 - 300 Then Form2.Timer14.Enabled = True Else: Form2.Timer14.Enabled = False End If Else: Form2.Timer14.Enabled = FalseEnd IfEnd SubPrivate Sub Timer3_Timer() -Z Select Case jingeibeilv 进给率调整速率50,100,150。 Case 0 ZouDao = 0 Case 1 ZouDao = 2 Case 2 ZouDao = 5 Case 3 ZouDao = 10 Case 4 ZouDao = 15 End SelectIf jingeibeilv = 0 Then 进给为零 zdyxbz = False Form1.Label4.Caption = 无法运行,进给率为0! Form1.Label39.Caption = 无法运行,进给率为0请调整进给率! Exit SubEnd IfIf Form5.Text1.Text 0.00 Then 轴类工件 If Timer1.Enabled = False And Timer2.Enabled = False Then 主轴没有旋转撞刀 If Image01.Top = 1185 + Val(Form5.Text1.Text) * 50 And Image01.Left = 30 + Val(Form5.Text6.Text) * 50 Then Form1.Label4.Caption = 主轴没有旋转撞刀 Form1.Label39.Caption = 主轴没有旋转撞刀 Timer3.Enabled = False Exit Sub End If End If Picture4.Line (0, Val(Form5.Text1.Text) * 25)-Step(7000, 0), RGB(0, 0, 255) 划中心线 Picture2.Line (0, Val(Form5.Text1.Text) * 25)-Step(7000, 0), RGB(0, 0, 255)ElseIf Form5.Text3.Text 0.00 Then 孔类工件 If Timer1.Enabled = False And Timer2.Enabled = False Then 主轴没有旋转撞刀 If Image01.Top = 1185 + Val(Form5.Text3.Text) * 50 And Image01.Left = 30 + Val(Form5.Text6.Text) * 50 Then Form1.Label4.Caption = 主轴没有旋转撞刀 Form1.Label39.Caption = 主轴没有旋转撞刀 Timer3.Enabled = False Exit Sub End If End If Picture1.Line (0, Val(Form5.Text4.Text) * 25)-Step(7000, 0), RGB(0, 0, 255) 划中心线 Picture2.Line (0, Val(Form5.Text3.Text) * 25)-Step(7000, 0), RGB(0, 0, 255)End IfForm2.XZcmd43.Enabled = TrueIf fangshi = 4 Then 方式4手动方式下 If Image01.Left -3845 Then X负向向超程解除ChaoCheng = 1 And(还没完成超程标) Form1.Label4.Caption = 运行正常 Form1.Label39.Caption = 运行正常 Form2.XZcmd40.Enabled = True Form2.XZcmd42.Enabled = True Form2.XZcmd40.Enabled = True Form2.XZcmd42.Enabled = True End IfEnd IfForm1.Picture7.Visible = True Z运行标志DaoJiaShuiDi01 切削液水滴移动01If Form4.Option3(0).Value = True Then Form1.Label31.Caption = T1 刀具号 Form1.Label33.Caption = D1UserC11.Move UserC11.Left - ZouDao, UserC11.TopPianDao1 90偏刀(粗)UserC21.Move UserC21.Left - ZouDao, UserC21.TopPianDao2 90偏刀(粗)隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text11(3).Text) - Val(Form1.Text11(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(1).Value = True Then Form1.Label31.Caption = T2 刀具号 Form1.Label33.Caption = D1UserC31.Move UserC31.Left - ZouDao, UserC31.Top 螺纹刀 - ZLuoWenDao1 螺纹刀UserC41.Move UserC41.Left - ZouDao, UserC41.TopLuoWenDao2 螺纹刀隐形刀具If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text12(3).Text) - Val(Form1.Text12(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(2).Value = True Then Form1.Label31.Caption = T3 刀具号 Form1.Label33.Caption = D1UserC51.Move UserC51.Left - ZouDao, UserC51.Top 精车刀-ZJingCheDao1 精车刀UserC61.Move UserC61.Left - ZouDao, UserC61.Top 隐形刀具JingCheDao2 精车刀隐形刀具If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text14(3).Text) - Val(Form1.Text14(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(3).Value = True Then Form1.Label31.Caption = T4 刀具号 Form1.Label33.Caption = D1UserC71.Move UserC71.Left - ZouDao, UserC71.Top 切槽刀-ZQieCaoDao1 切槽刀UserC81.Move UserC81.Left - ZouDao, UserC81.Top 隐形刀具QieCaoDao2 切槽刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text15(3).Text) - Val(Form1.Text15(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(4).Value = True Then Form1.Label31.Caption = T5 刀具号 Form1.Label33.Caption = D1UserC91.Move UserC91.Left - ZouDao, UserC91.Top 镗刀-ZTangDao1 镗刀UserC101.Move UserC101.Left - ZouDao, UserC101.Top 隐形刀具TangDao2 镗刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text16(3).Text) - Val(Form1.Text16(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form2.Picture11.BackColor = &H8000& ThenForm1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02Form1.Text2.Text = Format(Form1.Text2.Text, #0.000)End IfEnd SubPrivate Sub Timer5_Timer() -X Select Case jingeibeilv 进给率调整速率50,100,150。 Case 0 ZouDao = 0 Case 1 ZouDao = 2 Case 2 ZouDao = 5 Case 3 ZouDao = 10 Case 4 ZouDao = 15 End SelectIf jingeibeilv = 0 Then 进给为零 zdyxbz = False Form1.Label4.Caption = 无法运行,进给率为0! Form1.Label39.Caption = 无法运行,进给率为0请调整进给率! Exit SubEnd IfIf Form5.Text1.Text 0.00 Then 轴类工件 If Timer1.Enabled = False And Timer2.Enabled = False Then If Image01.Top = 1185 + Val(Form5.Text1.Text) * 50 And Image01.Left = 30 + Val(Form5.Text6.Text) * 50 Then Form1.Label4.Caption = 主轴没有旋转撞刀 Form1.Label39.Caption = 主轴没有旋转撞刀 Timer5.Enabled = False Exit Sub End If End If Picture4.Line (0, Val(Form5.Text1.Text) * 25)-Step(7000, 0), RGB(0, 0, 255) 划中心线 Picture2.Line (0, Val(Form5.Text1.Text) * 25)-Step(7000, 0), RGB(0, 0, 255)ElseIf Form5.Text3.Text 0.00 Then 孔类工件 If Timer1.Enabled = False And Timer2.Enabled = False Then If Image01.Top = 1185 + Val(Form5.Text3.Text) * 50 And Image01.Left = 30 + Val(Form5.Text6.Text) * 50 Then Form1.Label4.Caption = 主轴没有旋转撞刀 Form1.Label39.Caption = 主轴没有旋转撞刀 Timer5.Enabled = False Exit Sub End If End If Picture1.Line (0, Val(Form5.Text4.Text) * 25)-Step(7000, 0), RGB(0, 0, 255) 划中心线 Picture2.Line (0, Val(Form5.Text3.Text) * 25)-Step(7000, 0), RGB(0, 0, 255)End If Form2.XZcmd41.Enabled = TrueIf fangshi = 4 Then 指示灯亮-方式4手动方式下Form2.zsd1(4).BackColor = &H80FF80 If Image01.Top 800 Then Z负向向超程解除ChaoCheng = 1 And(还没完成超程标) Form1.Label4.Caption = 运行正常 Form1.Label39.Caption = 运行正常 Form2.XZcmd40.Enabled = True Form2.XZcmd42.Enabled = True Form2.XZcmd40.Enabled = True Form2.XZcmd42.Enabled = True End IfEnd IfForm1.Picture6.Visible = True X运行标志Image01.Move Image01.Left, Image01.Top - ZouDaoIf Form4.Option3(0).Value = True Then Form1.Label31.Caption = T1 刀具号 Form1.Label33.Caption = D1UserC11.Move UserC11.Left, UserC11.Top - ZouDao 90偏刀(粗)-XPianDao1 90偏刀(粗)UserC21.Move UserC21.Left, UserC21.Top + ZouDaoPianDao2 90偏刀(粗)隐形刀具Picture4.Line (UserC21.Left + 480, UserC21.Top + 1095 - 370)-Step(0, -715), RGB(128, 255, 128) If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text11(1).Text) - Val(Form1.Text11(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End IfEnd IfIf Form4.Option3(1).Value = True Then Form1.Label31.Caption = T2 刀具号 Form1.Label33.Caption = D1UserC31.Move UserC31.Left, UserC31.Top - ZouDao 螺纹刀 - XLuoWenDao1 螺纹刀UserC41.Move UserC41.Left, UserC41.Top + ZouDaoLuoWenDao2 螺纹刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text12(1).Text) - Val(Form1.Text12(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End IfEnd IfIf Form4.Option3(2).Value = True Then Form1.Label31.Caption = T3 刀具号 Form1.Label33.Caption = D1UserC51.Move UserC51.Left, UserC51.Top - ZouDao 精车刀-XJingCheDao1 精车刀UserC61.Move UserC61.Left, UserC61.Top + ZouDao 隐形刀具JingCheDao2 精车刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text14(1).Text) - Val(Form1.Text14(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End IfEnd IfIf Form4.Option3(3).Value = True Then Form1.Label31.Caption = T4 刀具号 Form1.Label33.Caption = D1UserC71.Move UserC71.Left, UserC71.Top - ZouDao 切槽刀-XQieCaoDao1 切槽刀UserC81.Move UserC81.Left, UserC81.Top + ZouDao 隐形刀具QieCaoDao2 切槽刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text15(1).Text) - Val(Form1.Text15(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End IfEnd IfIf Form4.Option3(4).Value = True Then Form1.Label31.Caption = T5 刀具号 Form1.Label33.Caption = D1UserC91.Move UserC91.Left, UserC91.Top - ZouDao 镗刀-ZTangDao1 镗刀UserC101.Move UserC101.Left, UserC101.Top + ZouDao 隐形刀具TangDao2 镗刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text16(1).Text) - Val(Form1.Text16(0).Text) 工件长度=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End IfEnd IfIf Form2.Picture11.BackColor = &H8000& ThenForm1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2Form1.Text1.Text = Format(Form1.Text1.Text, #0.000)End IfEnd SubPrivate Sub Timer4_Timer() +Z Select Case jingeibeilv 进给率调整速率50,100,150。 Case 0 ZouDao = 0 Case 1 ZouDao = 2 Case 2 ZouDao = 5 Case 3 ZouDao = 10 Case 4 ZouDao = 15 End SelectIf jingeibeilv = 0 Then 进给为零 zdyxbz = False Form1.Label4.Caption = 无法运行,进给率为0! Form1.Label39.Caption = 无法运行,进给率为0请调整进给率! Exit SubEnd IfForm2.XZcmd42.Enabled = TrueIf fangshi = 5 Then 方式5回参考点 Form2.zsd1(5).BackColor = &H80FF80 Form2.XZcmd40.Enabled = False Form2.XZcmd42.Enabled = False Timer4.Interval = 10 ZouDao = 10 If Image01.Left = 9000 Then Form2.XZcmd43.Enabled = False Form1.Text4.Text = 参考点回零 Form1.Label4.Caption = 参考点回零 Form1.Label39.Caption = 参考点回零 cankaodian = True 回参判断 Form1.Text2.Text = 0 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) Form1.Picture7.Visible = False 参考点图形显示 Form1.Picture4.Visible = True Timer4.Enabled = False Exit Sub End IfEnd IfIf fangshi = 4 Then 指示灯亮-方式4手动方式下Form2.zsd1(4).BackColor = &H80FF80 If Image01.Left = 9010 Then Form1.Label4.Caption = Z正向超程 Form1.Label39.Caption = Z正向超程请在手动方式下Z负向回程! Form2.XZcmd43.Enabled = False Timer4.Enabled = False 超程标志 ChaoCheng = 1 Exit Sub End If If Image01.Top = 8000 Then Form2.XZcmd41.Enabled = False Form1.Text4.Text = 参考点回零 Form1.Label4.Caption = 参考点回零 Form1.Label39.Caption = 参考点回零 cankaodian = True 回参判断 Form1.Text1.Text = 0 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Picture6.Visible = False 参考点图形显示 Form1.Picture3.Visible = True Timer6.Enabled = False Exit Sub End IfEnd IfIf fangshi = 4 Then 指示的亮-方式4手动Form2.zsd1(4).BackColor = &H80FF80 If Image01.Top = 8010 Then Form1.Label4.Caption = X正向超程 Form1.Label39.Caption = X正向超程请在手动方式下X负向回程! Form2.XZcmd41.Enabled = False Timer6.Enabled = False 超程标志 ChaoCheng = 1 Exit Sub End If If Image01.Left 9000 Then Z正向超程解除ChaoCheng = 1 And(还没完成超程标志) Form1.Label4.Caption = 运行正常 Form1.Label39.Caption = 运行正常 Form2.XZcmd40.Enabled = True Form2.XZcmd42.Enabled = True Form2.XZcmd40.Enabled = True Form2.XZcmd42.Enabled = True End IfEnd IfImage01.Move Image01.Left, Image01.Top + ZouDaoIf Form4.Option3(0).Value = True Then 90偏刀(粗)加工 Form1.Label31.Caption = T1 刀具号 Form1.Label33.Caption = D1UserC11.Move UserC11.Left, UserC11.Top + ZouDao 90偏刀(粗)+XPianDao1 90偏刀(粗)UserC21.Move UserC21.Left, UserC21.Top - ZouDaoPianDao2 90偏刀(粗)隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text11(1).Text) - Val(Form1.Text11(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End IfEnd IfIf Form4.Option3(1).Value = True Then 螺纹刀加工 Form1.Label31.Caption = T2 刀具号 Form1.Label33.Caption = D1UserC31.Move UserC31.Left, UserC31.Top + ZouDao 螺纹刀 +XLuoWenDao1 螺纹刀UserC41.Move UserC41.Left, UserC41.Top - ZouDaoLuoWenDao2 螺纹刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text12(1).Text) - Val(Form1.Text12(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End IfEnd IfIf Form4.Option3(2).Value = True Then 精车刀加工 Form1.Label31.Caption = T3 刀具号 Form1.Label33.Caption = D1UserC51.Move UserC51.Left, UserC51.Top + ZouDao 精车刀+XJingCheDao1 精车刀UserC61.Move UserC61.Left, UserC61.Top - ZouDao 隐形刀具JingCheDao2 精车刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text14(1).Text) - Val(Form1.Text14(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End IfEnd IfIf Form4.Option3(3).Value = True Then 切槽刀加工 Form1.Label31.Caption = T4 刀具号 Form1.Label33.Caption = D1UserC71.Move UserC71.Left, UserC71.Top + ZouDao 切槽刀+XQieCaoDao1 切槽刀UserC81.Move UserC81.Left, UserC81.Top - ZouDao 隐形刀具QieCaoDao2 切槽刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text15(1).Text) - Val(Form1.Text15(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End IfEnd IfIf Form4.Option3(4).Value = True Then Form1.Label31.Caption = T5 刀具号 Form1.Label33.Caption = D1UserC91.Move UserC91.Left, UserC91.Top + ZouDao 镗刀-ZTangDao1 镗刀UserC101.Move UserC101.Left, UserC101.Top - ZouDao 隐形刀具TangDao2 镗刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text16(1).Text) - Val(Form1.Text16(0).Text) 工件长度=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End IfEnd IfIf Form2.Picture11.BackColor = &H8000& ThenForm1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2Form1.Text1.Text = Format(Form1.Text1.Text, #0.000)End IfEnd SubPrivate Sub Timer7_Timer() 卡爪移动夹紧If Form5.Text1.Text 0.00 And Form5.Text3.Text = 0.00 Then If UCkp11.Top = 3400 + Val(Form5.Text1.Text) * 50 / 2 Then UCkp11.Move UCkp11.Left, UCkp11.Top + 5 卡爪移动 UCkp21.Move UCkp21.Left, UCkp21.Top + 5 UCkp41.Move UCkp41.Left, UCkp41.Top - 5 UCkp51.Move UCkp51.Left, UCkp51.Top - 5 Else Timer7.Enabled = False End IfElseIf Form5.Text3.Text 0.00 And Form5.Text1.Text = 0.00 Then If UCkp11.Top = 3400 + Val(Form5.Text3.Text) * 50 / 2 Then UCkp11.Move UCkp11.Left, UCkp11.Top + 5 卡爪移动 UCkp21.Move UCkp21.Left, UCkp21.Top + 5 UCkp41.Move UCkp41.Left, UCkp41.Top - 5 UCkp51.Move UCkp51.Left, UCkp51.Top - 5 Else Timer7.Enabled = False End IfEnd IfEnd SubPrivate Sub Timer8_Timer() 划中心线 Picture4.Line (0, Val(Form5.Text1.Text) * 25)-Step(7000, 0), RGB(0, 0, 255) 划中心线 Picture2.Line (0, Val(Form5.Text1.Text) * 25)-Step(7000, 0), RGB(0, 0, 255)End SubPrivate Sub DaoJiaShuiDi01() 刀架,水滴移动函数-Z Image01.Move Image01.Left - ZouDao, Image01.Top UserC0.Move UserC0.Left - ZouDao, UserC0.Top UserC1.Move UserC1.Left - ZouDao, UserC1.Top UserC2.Move UserC2.Left - ZouDao, UserC2.Top UserC3.Move UserC3.Left - ZouDao, UserC3.Top UserC4.Move UserC4.Left - ZouDao, UserC4.Top UserC5.Move UserC5.Left - ZouDao, UserC5.Top UserC6.Move UserC6.Left - ZouDao, UserC6.TopEnd SubPrivate Sub DaoJiaShuiDi02() 刀架,水滴移动函数+Z Image01.Move Image01.Left + ZouDao, Image01.Top UserC0.Move UserC0.Left + ZouDao, UserC0.Top UserC1.Move UserC1.Left + ZouDao, UserC1.Top UserC2.Move UserC2.Left + ZouDao, UserC2.Top UserC3.Move UserC3.Left + ZouDao, UserC3.Top UserC4.Move UserC4.Left + ZouDao, UserC4.Top UserC5.Move UserC5.Left + ZouDao, UserC5.Top UserC6.Move UserC6.Left + ZouDao, UserC6.TopEnd SubPrivate Sub PianDao1() 90偏刀(粗) Picture4.Line (UserC11.Left, UserC11.Top)-Step(0, 500), RGB(128, 255, 128) 工作刀具 Picture4.Line (UserC11.Left, UserC11.Top + 500)-Step(70, 0), RGB(128, 255, 128) Picture4.Line (UserC11.Left + 60, UserC11.Top + 500)-Step(0, 620), RGB(128, 255, 128) Picture4.Line (UserC11.Left, UserC11.Top - 20)-Step(350, 80), RGB(128, 255, 128) Picture4.Line (UserC11.Left + 350, UserC11.Top + 80)-Step(130, 310), RGB(128, 255, 128) Picture4.Line (UserC11.Left + 480, UserC11.Top + 380)-Step(0, 740), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC11.Left + 60, MDIForm1.UserC11.Top + 1120)-Step(420, 0), RGB(128, 255, 128)End SubPrivate Sub PianDao2() 90偏刀(粗)隐形刀具 Picture4.Line (UserC21.Left + 70, UserC21.Top)-Step(0, 625), RGB(128, 255, 128) 隐形刀具 Picture4.Line (UserC21.Left + 70, UserC21.Top + 625)-Step(-70, 0), RGB(128, 255, 128) Picture4.Line (UserC21.Left, UserC21.Top + 625)-Step(0, 480), RGB(128, 255, 128) Picture4.Line (UserC21.Left, UserC21.Top + 1150)-Step(350, -80), RGB(128, 255, 128) Picture4.Line (UserC21.Left + 360, UserC21.Top + 1095 - 70)-Step(130, -300), RGB(128, 255, 128) Picture4.Line (UserC21.Left + 480, UserC21.Top + 1095 - 370)-Step(0, -715), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC21.Left, MDIForm1.UserC21.Top)-Step(470, 0), RGB(128, 255, 128)End SubPrivate Sub LuoWenDao1() 螺纹刀Picture4.Line (UserC31.Left + 100, UserC31.Top - 10)-Step(-120, 240), RGB(128, 255, 128) 工作刀具Picture4.Line (UserC31.Left, UserC31.Top + 240)-Step(0, 930), RGB(128, 255, 128)Picture4.Line (UserC31.Left + 120, UserC31.Top - 10)-Step(120, 250), RGB(128, 255, 128)Picture4.Line (UserC31.Left + 240, UserC31.Top + 240)-Step(0, 930), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC31.Left, MDIForm1.UserC31.Top + 1160)-Step(240, 0), RGB(128, 255, 128)End SubPrivate Sub LuoWenDao2() 螺纹刀隐形刀具Picture4.Line (UserC41.Left, UserC41.Top)-Step(0, 930), RGB(128, 255, 128) 隐形刀具Picture4.Line (UserC41.Left, UserC41.Top + 930)-Step(125, 240), RGB(128, 255, 128)Picture4.Line (UserC41.Left + 110, UserC41.Top + 1170)-Step(110, -240), RGB(128, 255, 128)Picture4.Line (UserC41.Left + 260, UserC41.Top + 930)-Step(0, -930), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC41.Left, MDIForm1.UserC41.Top)-Step(240, 0), RGB(128, 255, 128)End SubPrivate Sub JingCheDao1() 精车刀Picture4.Line (UserC51.Left, UserC51.Top)-Step(0, 550), RGB(128, 255, 128) 工作刀具Picture4.Line (UserC51.Left, UserC51.Top + 550)-Step(80, 0), RGB(128, 255, 128)Picture4.Line (UserC51.Left + 80, UserC51.Top + 550)-Step(0, 610), RGB(128, 255, 128)Picture4.Line (UserC51.Left, UserC51.Top)-Step(360, 240), RGB(128, 255, 128)Picture4.Line (UserC51.Left + 360, UserC51.Top + 240)-Step(120, 360), RGB(128, 255, 128)Picture4.Line (UserC51.Left + 480, UserC51.Top + 600)-Step(0, 560), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC51.Left, MDIForm1.UserC51.Top + 1150)-Step(480, 0), RGB(128, 255, 128)End SubPrivate Sub JingCheDao2() 精车刀隐形刀具Picture4.Line (UserC61.Left + 80, UserC61.Top)-Step(0, 610), RGB(128, 255, 128)Picture4.Line (UserC61.Left + 80, UserC61.Top + 590)-Step(-80, 0), RGB(128, 255, 128)Picture4.Line (UserC61.Left, UserC61.Top + 610)-Step(0, 550), RGB(128, 255, 128)Picture4.Line (UserC61.Left, UserC61.Top + 1160)-Step(360, -240), RGB(128, 255, 128)Picture4.Line (UserC61.Left + 360, UserC61.Top + 920)-Step(120, -360), RGB(128, 255, 128)Picture4.Line (UserC61.Left + 490, UserC61.Top + 560)-Step(0, -550), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC61.Left, MDIForm1.UserC61.Top)-Step(480, 0), RGB(128, 255, 128)End SubPrivate Sub QieCaoDao1() 切槽刀Picture4.Line (UserC71.Left, UserC71.Top)-Step(0, 1160), RGB(128, 255, 128) 工作刀具Picture4.Line (UserC71.Left, UserC71.Top)-Step(240, 0), RGB(128, 255, 128)Picture4.Line (UserC71.Left + 240, UserC71.Top)-Step(0, 1160), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC71.Left, MDIForm1.UserC71.Top + 1160)-Step(240, 0), RGB(128, 255, 128)End SubPrivate Sub QieCaoDao2() 切槽刀隐形刀具Picture4.Line (UserC81.Left, UserC81.Top)-Step(0, 1155), RGB(128, 255, 128)Picture4.Line (UserC81.Left, UserC81.Top + 1150)-Step(240, 0), RGB(128, 255, 128)Picture4.Line (UserC81.Left + 240, UserC81.Top)-Step(0, 1155), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC81.Left, MDIForm1.UserC81.Top)-Step(240, 0), RGB(128, 255, 128)End SubPrivate Sub TangDao1() 镗刀Picture4.Line (UserC91.Left - 5, UserC91.Top + 450)-Step(50, -230), RGB(128, 255, 128) 工作刀具Picture4.Line (UserC91.Left + 50, UserC91.Top + 225)-Step(310, -230), RGB(128, 255, 128)Picture4.Line (UserC91.Left + 360, UserC91.Top)-Step(870, 0), RGB(128, 255, 128)Picture4.Line (UserC91.Left - 5, UserC91.Top + 465)-Step(420, 0), RGB(128, 255, 128)Picture4.Line (UserC91.Left + 420, UserC91.Top + 460)-Step(0, -160), RGB(128, 255, 128)Picture4.Line (UserC91.Left + 420, UserC91.Top + 290)-Step(810, 0), RGB(128, 255, 128)Picture4.Line (UserC91.Left + 1220, UserC91.Top)-Step(0, 280), RGB(128, 255, 128)End SubPrivate Sub TangDao2() 镗刀隐形刀具Picture4.Line (UserC101.Left, UserC101.Top)-Step(420, 0), RGB(128, 255, 128)Picture4.Line (UserC101.Left + 420, UserC101.Top)-Step(0, 160), RGB(128, 255, 128)Picture4.Line (UserC101.Left + 420, UserC101.Top + 160)-Step(810, 0), RGB(128, 255, 128)Picture4.Line (UserC101.Left + 1220, UserC101.Top + 160)-Step(0, 280), RGB(128, 255, 128)Picture4.Line (UserC101.Left, UserC101.Top)-Step(50, 230), RGB(128, 255, 128)Picture4.Line (UserC101.Left + 50, UserC101.Top + 235)-Step(310, 230), RGB(128, 255, 128)Picture4.Line (UserC101.Left + 350, UserC101.Top + 460)-Step(870, 0), RGB(128, 255, 128)End SubForm1:Private Sub Command28_Click() -Shift键作用Static bnbn As IntegerSelect Case bnbn Case 0 选上方字符 Shift = 1 bnbn = 1 Case 1 选下方字符 Shift = 0 bnbn = 0End SelectEnd SubPrivate Sub ZIFUSHURU() -字符输入函数 Select Case Asii 判断在那儿输入文本 Case 0 Text5.Text = Text5.Text & zifucs 输新程序名处 Text5.SetFocus Case 1 RichTB1(0).Text = RichTB1(0).Text & zifucs 输入程序段01 RichTB1(0).SetFocus Case 2 RichTB1(1).Text = RichTB1(1).Text & zifucs RichTB1(1).SetFocus Case 3 RichTB1(2).Text = RichTB1(2).Text & zifucs RichTB1(2).SetFocus Case 4 RichTB1(3).Text = RichTB1(3).Text & zifucs RichTB1(3).SetFocus Case 5 RichTB1(4).Text = RichTB1(4).Text & zifucs RichTB1(4).SetFocus Case 6 Text6.Text = Text6.Text & zifucs MDA程序输入 Text6.SetFocus End SelectEnd SubPrivate Sub Command14_Click() -字符F输入 If Shift = 0 Then zifucs = F ZIFUSHURU Else zifucs = O ZIFUSHURU End IfEnd SubPrivate Sub Command15_Click() -字符S输入If Shift = 0 Then zifucs = S ZIFUSHURU Else zifucs = Q ZIFUSHURU End IfEnd SubPrivate Sub Command16_Click() -字符M输入If Shift = 0 Then zifucs = M ZIFUSHURU Else zifucs = H ZIFUSHURUEnd IfEnd Sub Private Sub Command17_Click() -字符.输入 zifucs = . ZIFUSHURUEnd SubPrivate Sub Command18_Click(Index As Integer) -字符0-9输入Select Case IndexCase 0If Shift = 0 Then zifucs = 0 ZIFUSHURU Else zifucs = $ ZIFUSHURUEnd IfCase 1If Shift = 0 Then zifucs = 1 ZIFUSHURU Else zifucs = , ZIFUSHURUEnd IfCase 2 zifucs = 2 ZIFUSHURUCase 3If Shift = 0 Then zifucs = 3 ZIFUSHURU Else zifucs = = ZIFUSHURUEnd IfCase 4If Shift = 0 Then zifucs = 4 ZIFUSHURU Else zifucs = ZIFUSHURUEnd IfCase 8If Shift = 0 Then zifucs = 8 ZIFUSHURU Else zifucs = / ZIFUSHURUEnd IfCase 9If Shift = 0 Then zifucs = 9 ZIFUSHURU Else zifucs = + ZIFUSHURUEnd IfEnd SelectEnd SubPrivate Sub Command19_Click() -字符I输入If Shift = 0 Then zifucs = I ZIFUSHURU Else zifucs = ZIFUSHURUEnd IfEnd SubPrivate Sub Command20_Click() -字符J输入 If Shift = 0 Then zifucs = J ZIFUSHURU Else zifucs = ZIFUSHURUEnd IfEnd SubPrivate Sub Command21_Click() -字符K输入 zifucs = K ZIFUSHURUEnd SubPrivate Sub Command22_Click() -字符L输入If Shift = 0 Then zifucs = L ZIFUSHURU Else zifucs = _ ZIFUSHURUEnd IfEnd SubPrivate Sub Command23_Click() -字符P输入If Shift = 0 Then zifucs = P ZIFUSHURU Else zifucs = : ZIFUSHURUEnd IfEnd SubPrivate Sub Command24_Click() -字符R输入If Shift = 0 Then zifucs = R ZIFUSHURU Else zifucs = ZIFUSHURUEnd IfEnd SubPrivate Sub Command25_Click() -字符A输入If Shift = 0 Then zifucs = A ZIFUSHURU Else zifucs = U ZIFUSHURUEnd IfEnd SubPrivate Sub Command26_Click() -字符B输入If Shift = 0 Then zifucs = B ZIFUSHURU Else zifucs = V ZIFUSHURUEnd IfEnd SubPrivate Sub Command27_Click() -字符C输入If Shift = 0 Then zifucs = C ZIFUSHURU Else zifucs = W ZIFUSHURUEnd IfEnd SubPrivate Sub Command29_Click() -字符 输入 zifucs = ZIFUSHURUEnd SubPrivate Sub Command3_Click() 进入程序库Form7.ShowForm7.Enabled = TruePicture12.BackColor = &H80FF80 指示灯亮End SubPrivate Sub Command6_Click() -字符N输入 If Shift = 0 Then zifucs = N ZIFUSHURU Else zifucs = : ZIFUSHURU End IfEnd SubPrivate Sub Command7_Click(Index As Integer) -字符X、Y、Z输入Select Case IndexCase 0 zifucs = X ZIFUSHURUCase 1 zifucs = Y ZIFUSHURUCase 2 zifucs = Z ZIFUSHURUEnd SelectEnd SubPrivate Sub Command8_Click() -字符T输入 If Shift = 0 Then zifucs = T ZIFUSHURU Else zifucs = ( ZIFUSHURU End IfEnd SubPrivate Sub Command9_Click() -字符D输入If Shift = 0 Thenzifucs = D ZIFUSHURU Else zifucs = ) ZIFUSHURU End IfEnd SubPrivate Sub Command13_Click() -字符G输入 If Shift = 0 Then zifucs = G ZIFUSHURU Else zifucs = E ZIFUSHURU End IfEnd SubPrivate Sub Command30_Click() 回车按钮If Picture9.Visible = True Then -文件名输入状态If xinchengxu = 0 ThenPicture9.Visible = False Label19(0).Caption = Text5.Text RichTB1(0).Visible = True RichTB1(0).SetFocus 获得焦点,输入数据 Asii = 1 Label5.Caption = RichTB1(0).M(S)PFEnd IfIf xinchengxu = 1 Then Picture9.Visible = False Label19(1).Caption = Text5.Text RichTB1(1).Visible = True RichTB1(1).SetFocus 获得焦点,输入数据 Asii = 2 Label5.Caption = RichTB1(1).M(S)PFEnd IfIf xinchengxu = 2 Then Picture9.Visible = False Label19(2).Caption = Text5.Text RichTB1(2).Visible = True RichTB1(2).SetFocus 获得焦点,输入数据 Asii = 3 Label5.Caption = RichTB1(2).M(S)PFEnd IfIf xinchengxu = 3 Then Picture9.Visible = False Label19(3).Caption = Text5.Text RichTB1(3).Visible = True RichTB1(3).SetFocus 获得焦点,输入数据 Asii = 4 Label5.Caption = RichTB1(3).M(S)PFEnd IfIf xinchengxu = 4 Then Picture9.Visible = False Label19(4).Caption = Text5.Text RichTB1(4).Visible = True RichTB1(4).SetFocus 获得焦点,输入数据 Asii = 5 Label5.Caption = RichTB1(4).M(S)PFEnd IfElse -MDA输入状态 If cankaodian = False Then 回参判断 Label4.Caption = 没有回参考点! Label39.Caption = 没有回参考点!请点击进行回参考按钮,进行回参考点操作! Exit Sub Else: Label4.Caption = 运行正常 Label39.Caption = 运行正常 End If If jingeibeilv = 0 Then 进给为零 zdyxbz = False Label4.Caption = 无法运行,进给率为0! Label39.Caption = 无法运行,进给率为0请调整进给倍率 Exit Sub Else: Label4.Caption = 运行正常 Label39.Caption = 运行正常 End IfRichTB(0).Text = Text6.Text -MDA输入Text6.Text = End If -End SubPrivate Sub Command31_Click(Index As Integer) 上下选择Static wjk As IntegerSelect Case IndexCase 0 Select Case wenjiani Case 0 For wjk = 0 To 3 Label19(wjk).BackColor = &HFFFFFF Next wjk Label19(4).BackColor = &HC0FFC0 wenjiani = 4 Case 1 Label19(0).BackColor = &HC0FFC0 For wjk = 1 To 4 Label19(wjk).BackColor = &HFFFFFF Next wjk wenjiani = wenjiani - 1 Case 2 Label19(0).BackColor = &HFFFFFF Label19(1).BackColor = &HC0FFC0 For wjk = 2 To 4 Label19(wjk).BackColor = &HFFFFFF Next wjk wenjiani = wenjiani - 1 Case 3 Label19(0).BackColor = &HFFFFFF Label19(1).BackColor = &HFFFFFF Label19(2).BackColor = &HC0FFC0 Label19(3).BackColor = &HFFFFFF Label19(4).BackColor = &HFFFFFF wenjiani = wenjiani - 1 Case 4 For wjk = 0 To 2 Label19(wjk).BackColor = &HFFFFFF Next wjk Label19(3).BackColor = &HC0FFC0 Label19(4).BackColor = &HFFFFFF wenjiani = wenjiani - 1 End SelectCase 1 Select Case wenjiani Case 0 Label19(0).BackColor = &HFFFFFF Label19(1).BackColor = &HC0FFC0 For wjk = 2 To 4 Label19(wjk).BackColor = &HFFFFFF Next wjk wenjiani = wenjiani + 1 Case 1 Label19(0).BackColor = &HFFFFFF Label19(1).BackColor = &HFFFFFF Label19(2).BackColor = &HC0FFC0 Label19(3).BackColor = &HFFFFFF Label19(4).BackColor = &HFFFFFF wenjiani = wenjiani + 1 Case 2 For wjk = 0 To 2 Label19(wjk).BackColor = &HFFFFFF Next wjk Label19(3).BackColor = &HC0FFC0 Label19(4).BackColor = &HFFFFFF wenjiani = wenjiani + 1 Case 3 For wjk = 0 To 3 Label19(wjk).BackColor = &HFFFFFF Next wjk Label19(4).BackColor = &HC0FFC0 wenjiani = wenjiani + 1 Case 4 Label19(0).BackColor = &HC0FFC0 For wjk = 1 To 4 Label19(wjk).BackColor = &HFFFFFF Next wjk wenjiani = 0 End SelectCase 2Case 3End SelectEnd SubPrivate Sub Command11_Click(Index As Integer) 命令按钮组&Select Case IndexCase 0 刀具补偿 Picture10(0).Visible = True For anniu = 0 To 14 Command11(anniu).Visible = False Next anniu For anniu = 15 To 19 Command11(anniu).Visible = True Next anniu For anniu = 20 To 24 Command11(anniu).Visible = False Next anniuLabel13.Caption = 复位刀沿Label14.Caption = Label16.Caption = Label17.Caption = 对刀Case 1 程检Timer2.Enabled = TrueCase 2 程序名界面 Picture8.Visible = True RichTB(0).Visible = False RichTB(1).Visible = False For richi = 0 To 4 RichTB1(richi).Visible = False Next richi Picture9.Visible = False Form1.Timer2.Enabled = False 程检强行停止Case 3 机床/工件坐标屏幕显示Static jizuobiaoi As IntegerIf jizuobiaoi = 0 Then Text4.Text = 工件坐标 Form2.Picture11.BackColor = &H80FF80 机床/工件坐标指示灯亮 If Form4.Option3(0).Value = True Then 1号刀具加工位置 Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text11(3).Text) - Val(Form1.Text11(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text11(1).Text) - Val(Form1.Text11(0).Text) 工件直径=X机床坐标+X磨损-X偏置 End If If Form4.Option3(1).Value = True Then Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text12(3).Text) - Val(Form1.Text12(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text12(1).Text) - Val(Form1.Text12(0).Text) 工件直径=X机床坐标+X磨损-X偏置 End If If Form4.Option3(2).Value = True Then Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text14(3).Text) - Val(Form1.Text14(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text14(1).Text) - Val(Form1.Text14(0).Text) 工件直径=X机床坐标+X磨损-X偏置 End If If Form4.Option3(3).Value = True Then Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text15(3).Text) - Val(Form1.Text15(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text15(1).Text) - Val(Form1.Text15(0).Text) 工件直径=X机床坐标+X磨损-X偏置 End If If Form4.Option3(4).Value = True Then Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text16(3).Text) - Val(Form1.Text16(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text16(1).Text) - Val(Form1.Text16(0).Text) 工件直径=X机床坐标+X磨损-X偏置 End If Text1.Text = Format(Text1.Text, #0.000) Text2.Text = Format(Text2.Text, #0.000) jizuobiaoi = jizuobiaoi + 1Else: Text4.Text = 机床坐标 Form2.Picture11.BackColor = &H8000& 机床/工件坐标指示灯灭 Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + 300 Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + 105 直径 Text1.Text = Format(Text1.Text, #0.000) Text2.Text = Format(Text2.Text, #0.000) jizuobiaoi = 0 End IfCase 4 选择:加工前必须先选择程序 Picture9.Visible = False RichTB(0).Visible = False RichTB(1).Visible = False For richi = 0 To 4 RichTB1(richi).Visible = False Next richi Picture8.Visible = False For labeli = 0 To 4 If Label19(labeli).BackColor = &HC0FFC0 Then RichTB(0).Text = RichTB1(labeli).Text Label5.Caption = Label19(labeli).Caption End If Next labeliCase 5 加工 For anniu = 0 To 4 Command11(anniu).Visible = True Next anniu For anniu = 5 To 24 Command11(anniu).Visible = False Next anniu Label13.Caption = Label14.Caption = 自动 Label15.Caption = Label16.Caption = 机/工坐标 Label17.Caption = Label35.Visible = False Label36.Visible = FalseCase 6 参数 For anniu = 0 To 4 Command11(anniu).Visible = True Next anniu For anniu = 5 To 24 Command11(anniu).Visible = False Next anniu Label13.Caption = 刀具补偿 Label14.Caption = Label15.Caption = Label16.Caption = Label17.Caption = Label35.Visible = False Label36.Visible = FalseCase 7 程序 For anniu = 0 To 4 Command11(anniu).Visible = True Next anniu For anniu = 5 To 24 Command11(anniu).Visible = False Next anniu Label13.Caption = Label14.Caption = 程序检验 Label15.Caption = 程序 Label16.Caption = Label17.Caption = 选择 Label35.Visible = True kkjj = 1Case 8 通讯 For anniu = 0 To 4 Command11(anniu).Visible = True Next anniu For anniu = 5 To 24 Command11(anniu).Visible = False Next anniu Label13.Caption = Label14.Caption = Label15.Caption = Label16.Caption = Label17.Caption = Label35.Visible = False Label36.Visible = FalseCase 9 诊断 Picture11.Visible = True 程序诊断界面 For anniu = 0 To 4 Command11(anniu).Visible = True Next anniu For anniu = 5 To 24 Command11(anniu).Visible = False Next anniu Label13.Caption = Label14.Caption = Label15.Caption = Label16.Caption = Label17.Caption = Label35.Visible = False Label36.Visible = FalseCase 10 打开程序 Picture8.Visible = False RichTB(0).Visible = False RichTB(1).Visible = False For richi = 0 To 4 RichTB1(richi).Visible = False Next richi For labeli = 0 To 4 If Label19(labeli).BackColor = &HC0FFC0 Then RichTB1(labeli).Visible = True Asii = labeli + 1 RichTB1(labeli).SetFocus 输入获得焦点 End If Next labeliCase 11 新建程序 Picture9.Visible = True RichTB(0).Visible = False RichTB(1).Visible = False For richi = 0 To 4 RichTB1(richi).Visible = False Next richi Picture8.Visible = False Select Case XCXI Case 0 xinchengxu = 0 XCXI = XCXI + 1 Case 1 xinchengxu = 1 XCXI = XCXI + 1 Case 2 xinchengxu = 2 XCXI = XCXI + 1 Case 3 xinchengxu = 3 XCXI = XCXI + 1 Case 4 xinchengxu = 4 XCXI = 0 End Select Text5.Text = Text5.SetFocus 新建程序名输入获得焦点 Asii = 0Case 12 删除 For labeli = 0 To 4 If Label19(labeli).BackColor = &HC0FFC0 Then RichTB1(labeli).Text = Label19(labeli).Caption = XCXI = labeli End If Next labeliCase 13Case 14 关闭 RichTB(0).Visible = False RichTB(1).Visible = False For richi = 0 To 4 RichTB1(richi).Visible = False Next richi Picture8.Visible = False Label5.Caption = Case 15 复位刀沿 If Text11(0).Visible = True Then For anniu = 0 To 3 Text11(anniu).Text = 0.000 Next anniu End If If Text12(0).Visible = True Then For anniu = 0 To 3 Text12(anniu).Text = 0.000 Next anniu End If If Text14(0).Visible = True Then For anniu = 0 To 3 Text14(anniu).Text = 0.000 Next anniu End If If Text15(0).Visible = True Then For anniu = 0 To 3 Text15(anniu).Text = 0.000 Next anniu End If If Text16(0).Visible = True Then For anniu = 0 To 3 Text16(anniu).Text = 0.000 Next anniu End If If Text17(0).Visible = True Then For anniu = 0 To 3 Text17(anniu).Text = 0.000 Next anniu End If Case 16 For anniu = 0 To 3 Text11(anniu).Visible = False Next anniu For anniu = 0 To 3 Text12(anniu).Visible = False Next anniu For anniu = 0 To 3 Text14(anniu).Visible = False Next anniu For anniu = 0 To 3 Text15(anniu).Visible = False Next anniu For anniu = 0 To 3 Text16(anniu).Visible = False Next anniu For anniu = 0 To 3 Text17(anniu).Visible = False Next anniuSelect Case mm Case 0 Text7.Text = 2 Text21.Text = 2 For anniu = 0 To 3 Text12(anniu).Visible = True Next anniu mm = mm + 1 Case 1 Text7.Text = 3 Text21.Text = 3 For anniu = 0 To 3 Text14(anniu).Visible = True Next anniu mm = mm + 1 Case 2 Text7.Text = 4 Text21.Text = 4 For anniu = 0 To 3 Text15(anniu).Visible = True Next anniu mm = mm + 1 Case 3 Text7.Text = 5 Text21.Text = 5 For anniu = 0 To 3 Text16(anniu).Visible = True Next anniu mm = mm + 1 Case 4 Text7.Text = 6 Text21.Text = 6 For anniu = 0 To 3 Text17(anniu).Visible = True Next anniu mm = mm + 1 Case 5 Text7.Text = 1 Text21.Text = 1 For anniu = 0 To 3 Text11(anniu).Visible = True Next anniu mm = 0End Select Text19(0).Text = 0 Text20(0).Text = 0 Text19(0).Text = Format(Text19(0).Text, #0.000) Text20(0).Text = Format(Text20(0).Text, #0.000) Text19(1).Text = 0 Text20(1).Text = 0 Text19(1).Text = Format(Text19(1).Text, #0.000) Text20(1).Text = Format(Text20(1).Text, #0.000)Case 18Case 19 对刀 Picture10(0).Visible = False 刀具补偿界面 Picture10(1).Visible = True 对刀界面 Picture12.Visible = False Text10(0).Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 机床坐标(X) Text10(1).Text = (MDIForm1.Image01.Left - 9000) * 0.02 机床坐标(Z) Text10(0).Text = Format(Text10(0).Text, #0.000) Text10(1).Text = Format(Text10(1).Text, #0.000) Text9.Visible = False Text10(0).Visible = True Text19(0).Visible = True Text20(0).Visible = True For anniu = 0 To 19 Command11(anniu).Visible = False Next anniu For anniu = 20 To 24 Command11(anniu).Visible = True Next anniu Label13.Caption = Label14.Caption = 轴+ Label15.Caption = Label16.Caption = 计算 Label17.Caption = 确定 Label36.Visible = True jjkk = 2 Text19(0).SetFocus X直径,输入获得焦点Case 20Case 21 轴+ If Text9.Visible = False Then Text9.Visible = True Text10(1).Visible = True Text19(1).Visible = True Picture12.Visible = True Z对刀显示图 Text20(1).Visible = True Text10(0).Visible = False Text19(0).Visible = False Text20(0).Visible = False Else Text9.Visible = False Picture12.Visible = False Z对刀显示图 Text10(1).Visible = False Text19(1).Visible = False Text20(1).Visible = False Text10(0).Visible = True Text19(0).Visible = True Text20(0).Visible = True End If Text19(1).SetFocus Z长度,输入获得焦点Case 22Case 23 计算 If Text9.Visible = False Then Text20(0).Text = Val(Text10(0).Text) - Val(Text19(0).Text) Text20(0).Text = Format(Text20(0).Text, #0.000) Else Text20(1).Text = Val(Text10(1).Text) - Val(Text19(1).Text) Text20(1).Text = Format(Text20(1).Text, #0.000) End IfCase 24 确定 Picture10(0).Visible = True 刀具补偿界面 Picture10(1).Visible = False 对刀界面 If Text7.Text = 1 Then Text11(0).Text = Val(Text20(0).Text) 1号刀X偏置 Text11(2).Text = Val(Text20(1).Text) 1号刀Z偏置 Text11(0).Text = Format(Text11(0).Text, #0.000) Text11(2).Text = Format(Text11(2).Text, #0.000) ElseIf Text7.Text = 2 Then Text12(0).Text = Val(Text20(0).Text) Text12(2).Text = Val(Text20(1).Text) Text12(0).Text = Format(Text12(0).Text, #0.000) Text12(2).Text = Format(Text12(2).Text, #0.000) ElseIf Text7.Text = 3 Then Text14(0).Text = Val(Text20(0).Text) Text14(2).Text = Val(Text20(1).Text) Text14(0).Text = Format(Text14(0).Text, #0.000) Text14(2).Text = Format(Text14(2).Text, #0.000) ElseIf Text7.Text = 4 Then Text15(0).Text = Val(Text20(0).Text) Text15(2).Text = Val(Text20(1).Text) Text15(0).Text = Format(Text15(0).Text, #0.000) Text15(2).Text = Format(Text15(2).Text, #0.000) ElseIf Text7.Text = 5 Then Text16(0).Text = Val(Text20(0).Text) Text16(2).Text = Val(Text20(1).Text) Text16(0).Text = Format(Text16(0).Text, #0.000) Text16(2).Text = Format(Text16(2).Text, #0.000) ElseIf Text7.Text = 6 Then Text17(0).Text = Val(Text20(0).Text) Text17(2).Text = Val(Text20(1).Text) Text17(0).Text = Format(Text17(0).Text, #0.000) Text17(2).Text = Format(Text17(2).Text, #0.000) End If For anniu = 0 To 14 Command11(anniu).Visible = False Next anniu For anniu = 15 To 19 Command11(anniu).Visible = True Next anniu For anniu = 20 To 24 Command11(anniu).Visible = False Next anniu Label13.Caption = 复位刀沿 Label14.Caption = Label16.Caption = Label17.Caption = 对刀End SelectEnd Sub &*&*&*&*&*&*&*&Private Sub RichTB1_GotFocus(Index As Integer)RichTB1(0).SelStart = Len(RichTB1(0).Text) -在RichTB1(0)控件中,保持光标一直在最后RichTB1(1).SelStart = Len(RichTB1(1).Text)RichTB1(2).SelStart = Len(RichTB1(2).Text)RichTB1(3).SelStart = Len(RichTB1(3).Text)RichTB1(4).SelStart = Len(RichTB1(4).Text)End SubPrivate Sub Text5_GotFocus() 建文件名获得焦点 Text5.SelStart = Len(Text5.Text) -在text5box控件中,保持光标一直在最后End SubPrivate Sub Text5_KeyPress(KeyAscii As Integer) 建文件名If KeyAscii = 13 And xinchengxu = 0 ThenPicture9.Visible = False Label19(0).Caption = Text5.Text RichTB1(0).Visible = True RichTB1(0).SetFocus 获得焦点,输入数据 Asii = 1 Label5.Caption = RichTB1(0).M(S)PFEnd IfIf KeyAscii = 13 And xinchengxu = 1 Then Picture9.Visible = False Label19(1).Caption = Text5.Text RichTB1(1).Visible = True RichTB1(1).SetFocus 获得焦点,输入数据 Asii = 2 Label5.Caption = RichTB1(1).M(S)PFEnd IfIf KeyAscii = 13 And xinchengxu = 2 Then Picture9.Visible = False Label19(2).Caption = Text5.Text RichTB1(2).Visible = True RichTB1(2).SetFocus 获得焦点,输入数据 Asii = 3 Label5.Caption = RichTB1(2).M(S)PFEnd IfIf KeyAscii = 13 And xinchengxu = 3 Then Picture9.Visible = False Label19(3).Caption = Text5.Text RichTB1(3).Visible = True RichTB1(3).SetFocus 获得焦点,输入数据 Asii = 4 Label5.Caption = RichTB1(3).M(S)PFEnd IfIf KeyAscii = 13 And xinchengxu = 4 Then Picture9.Visible = False Label19(4).Caption = Text5.Text RichTB1(4).Visible = True RichTB1(4).SetFocus 获得焦点,输入数据 Asii = 5 Label5.Caption = RichTB1(4).M(S)PFEnd IfEnd SubPrivate Sub Text6_GotFocus() MDA输入 Text6.SelStart = Len(Text6.Text) 在textbox控件中,保持光标一直在最后End SubPrivate Sub Text6_KeyPress(KeyAscii As Integer) MDA输入If KeyAscii = 13 ThenRichTB(0).Text = Text6.TextEnd IfEnd Sub*Private Sub Command4_Click() 左翻菜单If kkjj = 1 Then For anniu = 0 To 9 Command11(anniu).Visible = False Next anniu For anniu = 10 To 14 Command11(anniu).Visible = True Next anniu For anniu = 15 To 19 Command11(anniu).Visible = False Next anniu Label13.Caption = 打开 Label14.Caption = 新程序 Label15.Caption = 删除 Label16.Caption = 改名 Label17.Caption = 关闭 Label35.Visible = False Label36.Visible = True jjkk = 0End IfEnd SubPrivate Sub Command5_Click() 返回主菜单 Picture10(0).Visible = False 刀具补偿界面 Picture10(1).Visible = False 刀具对刀界面 Picture8.Visible = False 程序选择界面 Picture9.Visible = False 给定程序名界面 Picture11.Visible = False 程序诊断界面 RichTB(0).Visible = False RichTB(1).Visible = False For anniu = 0 To 4 输入程序界面 RichTB1(anniu).Visible = False Next anniu For anniu = 0 To 4 Command11(anniu).Visible = False Next anniu For anniu = 5 To 9 Command11(anniu).Visible = True Next anniu For anniu = 10 To 24 Command11(anniu).Visible = False Next anniu Label13.Caption = 加工 Label14.Caption = 参数 Label15.Caption = 程序 Label16.Caption = 通讯 Label17.Caption = 诊断 Label35.Visible = False Label36.Visible = FalseEnd SubPrivate Sub Command1_Click() M按钮、返回主菜单 Picture10(0).Visible = False 刀具补偿界面 Picture10(1).Visible = False 刀具对刀界面 Picture8.Visible = False 程序选择界面 Picture9.Visible = False 给定程序名界面 Picture11.Visible = False 程序诊断界面 RichTB(0).Visible = False RichTB(1).Visible = False For anniu = 0 To 4 输入程序界面 RichTB1(anniu).Visible = False Next anniu For anniu = 0 To 4 Command11(anniu).Visible = False Next anniu For anniu = 5 To 9 Command11(anniu).Visible = True Next anniu For anniu = 10 To 24 Command11(anniu).Visible = False Next anniu Label13.Caption = 加工 Label14.Caption = 参数 Label15.Caption = 程序 Label16.Caption = 通讯 Label17.Caption = 诊断 Label35.Visible = False Label36.Visible = FalseEnd SubPrivate Sub Command2_Click() 菜单上翻按钮If jjkk = 0 Then For anniu = 0 To 4 Command11(anniu).Visible = True Next anniu For anniu = 5 To 24 Command11(anniu).Visible = False Next anniu Label13.Caption = Label14.Caption = 程序检验 Label15.Caption = 程序 Label16.Caption = Label17.Caption = 选择 Label35.Visible = True kkjj = 1 Label36.Visible = FalseElseIf jjkk = 2 Then Picture10(0).Visible = True 刀具补偿界面 Picture10(1).Visible = False 对刀界面 For anniu = 0 To 14 Command11(anniu).Visible = False Next anniu For anniu = 15 To 19 Command11(anniu).Visible = True Next anniu For anniu = 20 To 24 Command11(anniu).Visible = False Next anniu Label13.Caption = 复位刀沿 Label14.Caption = Label16.Caption = Label17.Caption = 对刀 Label36.Visible = FalseEnd IfEnd SubPrivate Sub Timer1_Timer() S转速显示(计时器)Static ii As IntegerStatic JJ As IntegerStatic ddss As SingleIf dataS = 0 Then JJ = 15000 / MDIForm1.Timer1.Interval ddss = JJ * G96CanShu If ddss = LIMS Then ddss = LIMS End If Select Case ii Case 0 Label30.Caption = ddss + 1 + .602 ii = ii + 1 Case 1 Label30.Caption = ddss + .153 ii = ii + 1 Case 2 Label30.Caption = ddss + -1 + .417 ii = 0 End SelectElse -自动运行时ddss = dataS * G96CanShu If ddss = LIMS Then ddss = LIMS End If Select Case ii Case 0 Text3.Text = ddss + 1 + .602 Label30.Caption = ddss + 1 + .602 ii = ii + 1 Case 1 Text3.Text = ddss + .153 Label30.Caption = ddss + .153 ii = ii + 1 Case 2 Text3.Text = ddss + -1 + .417 Label30.Caption = ddss + -1 + .417 ii = 0 End SelectEnd If Label30.Caption = Format(Label30.Caption, #0.000)End SubPrivate Sub Timer3_Timer() SP转速显示(计时器)Static rr As SingleIf rr 行数为1string_flag = 1 标志为1test_string = Right(src_str, 2)If test_string vbCrLf Thentest_string = src_str + vbCrLfElsetest_string = src_strEnd IfDoEventsDoline_cnt = line_cnt + 1string_flag = InStr(test_string, vbCrLf)ret_string = Left(test_string, string_flag)test_string = Right(test_string, Len(test_string) - string_flag - 1)Loop Until lineno = line_cntIf line_cnt = 1 Then ReadStringLine = ret_stringElseReadStringLine = Left(ret_string, Len(ret_string) - 1)End IfEnd FunctionPrivate Sub Timer2_Timer() 自动运行时行显示的切换时间chengxujianyanEnd Sub %3.chengxuzhix()Private Sub chengxujianyan() 自动运行时程序的读入与执行 Static str88, CJ As String Static mi As Integer Do Until UCase(str88) = M30 Or UCase(str88) = M02 Or UCase(Trim(str88) = RETURN 或者Do While UCase(str88) M30 Or UCase(str88) M02 Or UCase(Trim(str88) RETURN str88 = ReadStringLine(Form1.RichTB(0).Text, mi) DaiMaWenJian = FreeFile 代码文件 Open e:mdifile.txt For Output As #DaiMaWenJian Print #DaiMaWenJian, Trim(UCase(str3) Close #DaiMaWenJian DaiMaWenJian = FreeFile Open e:mdifile.txt For Input As #1 DMWJ = FreeFile 代码文件 Open e:mdifile.txt For Output As #DMWJ Print #DMWJ, Trim(UCase(str88) Close #DMWJ DMWJ = FreeFile Open e:mdifile.txt For Input As #1 Do Until EOF(1) CJ = UCase(Trim(Input$(1, #1) If CJ = Or CJ = Or CJ = Or CJ = ¥ Or CJ = % Or CJ = Or CJ = & Or CJ = Or CJ = Or CJ = 【 Or CJ = 】 Or CJ = | Or CJ = 、 Then Form1.Label4.Caption = 非标准代码 Close #1 Timer2.Enabled = False Text8.Text = mi mi = 0 回到初始值 Exit Sub ElseIf CJ = , Or CJ = ? Or CJ = ; Or CJ = Or CJ = “ Or CJ = Or CJ = ! Or CJ = Or CJ = Then Form1.Label4.Caption = 非标准代码 Close #1 Timer2.Enabled = False Text8.Text = mi mi = 0 回到初始值 Exit Sub ElseIf CJ = # Or CJ = ? Then Form1.Label4.Caption = 非标准代码 Close #1 Timer2.Enabled = False Text8.Text = mi mi = 0 回到初始值 Exit Sub Else: Form1.Label4.Caption = 标准代码 Text8.Text = mi End If Loop Close #1 mi = mi + 1 Exit Do Loop If UCase(str88) = M30 Or UCase(str88) = M02 Or UCase(Trim(str88) = RETURN Then Form1.Text8.Text = Form1.Label4.Caption = 程序检验通过 Timer2.Enabled = False str88 = CJ = mi = 0 End If End SubForm2:Public ZhiJing As Integer 直径、半径Public N158X, N158Z As Single G158偏置,X/Z偏移量Private Sub Command34_Click() 装/卸顶尖If Form5.Text1.Text = 0.00 Then Form1.Label4.Caption = 顶尖装夹错误! Form1.Label39.Caption = 顶尖装夹错误!轴的直径不能为“0”或孔类工件不能装夹 Exit SubElse: Form1.Label4.Caption = 运行正常! Form1.Label39.Caption = 运行正常!End IfMDIForm1.UserControl11.Visible = TrueSelect Case djianCase 0 MDIForm1.UserControl11.Top = Val(Form5.Text1.Text) * 50 / 2 - 625 MDIForm1.UserControl11.Left = Val(Form5.Text6.Text) * 50 + 3000 Picture8.BackColor = &H80FF80 Timer12.Enabled = True djian = djian + 1 dingjian = True 顶尖应用判断Case 1 MDIForm1.UserControl11.Top = Val(Form5.Text1.Text) * 50 / 2 - 625 MDIForm1.UserControl11.Left = Val(Form5.Text6.Text) * 50 - 300 Picture8.BackColor = &H8000& Timer13.Enabled = True Timer14.Enabled = False MDIForm1.UserControl21.Visible = False djian = 0 dingjian = False 顶尖应用判断End SelectEnd SubPrivate Sub Command35_Click() 开关切削液If MDIForm1.UserC0.Visible = False Then 水龙头没有-水龙头出现 MDIForm1.UserC0.Visible = True Picture9.BackColor = &HFF& 红ElseIf MDIForm1.UserC0.Visible = True And MDIForm1.Timer11.Enabled = False And MDIForm1.UserC1.Visible = False And MDIForm1.UserC3.Visible = False Then MDIForm1.UserC0.Visible = True 水龙头有、水滴没有、两股流水都停-流水开 Picture9.BackColor = &H80FF80 绿(工作) MDIForm1.Timer11.Enabled = TrueElseIf MDIForm1.UserC0.Visible = True And MDIForm1.Timer11.Enabled = True Then MDIForm1.Timer11.Enabled = False 水龙头有、流水开-流水停 Picture9.BackColor = &HFF& 红ElseIf Picture9.BackColor = &HFF& And MDIForm1.Timer11.Enabled = False And MDIForm1.UserC1.Visible = True Or MDIForm1.UserC3.Visible = True Then MDIForm1.UserC0.Visible = False 水龙头有、任一股流水看见-全没有(停) Picture9.BackColor = &H8000& 浅绿 MDIForm1.Timer11.Enabled = False MDIForm1.UserC1.Visible = False MDIForm1.UserC2.Visible = False MDIForm1.UserC3.Visible = False MDIForm1.UserC4.Visible = False MDIForm1.UserC5.Visible = False MDIForm1.UserC6.Visible = FalseEnd IfEnd SubPrivate Sub Command38_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)Form7.ShowForm7.Enabled = TruePicture12.BackColor = &H80FF80 指示灯亮End SubPrivate Sub Command38_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)Picture12.BackColor = &H8000& 机床/工件坐标指示灯灭End SubPrivate Sub Timer11_Timer() -G96/G97 G96CanShu = dataS * Val(MDIForm1.Image01.Top * 0.02) 动态的速度变化参数 G96CanShu = dataS * (Val(Form1.Text13(13).Text) + xmbz) / 10 If CODE15 = 1 Then G96CanShu = G97CanShu / (Val(MDIForm1.Image01.Top - 8000) * 0.02 * 2) + 2 + Val(Form1.Text11(1).Text) - Val(Form1.Text11(0).Text) ElseIf CODE15 = 2 Then G96CanShu = G97CanShu / (Val(MDIForm1.Image01.Top - 8000) * 0.02 * 2) + 2 + Val(Form1.Text12(1).Text) - Val(Form1.Text12(0).Text) ElseIf CODE15 = 3 Then G96CanShu = G97CanShu / (Val(MDIForm1.Image01.Top - 8000) * 0.02 * 2) + 2 + Val(Form1.Text14(1).Text) - Val(Form1.Text14(0).Text) ElseIf CODE15 = 4 Then G96CanShu = G97CanShu / (Val(MDIForm1.Image01.Top - 8000) * 0.02 * 2) + 2 + Val(Form1.Text15(1).Text) - Val(Form1.Text15(0).Text) ElseIf CODE15 = 5 Then G96CanShu = G97CanShu / (Val(MDIForm1.Image01.Top - 8000) * 0.02 * 2) + 2 + Val(Form1.Text16(1).Text) - Val(Form1.Text16(0).Text) End IfEnd SubPrivate Sub Timer12_Timer() 装顶尖 If MDIForm1.UserControl11.Left Val(Form5.Text6.Text) * 50 - 300 Then MDIForm1.UserControl11.Move MDIForm1.UserControl11.Left - 15, MDIForm1.UserControl11.Top Else Timer12.Enabled = False If Form1.Text3.Text 0.000 Then 主轴旋转时顶尖转 Timer14.Enabled = True Else: Timer14.Enabled = False End If If MDIForm1.Timer1.Enabled = True Then 主轴旋转时顶尖转 Timer14.Enabled = True Else: Timer14.Enabled = False End If MDIForm1.UserControl21.Top = Val(Form5.Text1.Text) * 50 / 2 - 625 MDIForm1.UserControl21.Left = Val(Form5.Text6.Text) * 50 - 300 End IfEnd SubPrivate Sub Timer13_Timer() 卸顶尖 If MDIForm1.UserControl11.Left Val(Form5.Text6.Text) * 50 + 3000 Then MDIForm1.UserControl11.Move MDIForm1.UserControl11.Left + 15, MDIForm1.UserControl11.Top Else Timer13.Enabled = False MDIForm1.UserControl11.Visible = False End IfEnd SubPrivate Sub Timer14_Timer() 顶尖旋转Static xz As IntegerSelect Case xzCase 0MDIForm1.UserControl11.Visible = TrueMDIForm1.UserControl21.Visible = Falsexz = xz + 1Case 1MDIForm1.UserControl11.Visible = FalseMDIForm1.UserControl21.Visible = Truexz = 0End SelectIf MDIForm1.Timer1.Enabled = False Then Timer14.Enabled = FalseEnd IfEnd SubPrivate Sub Image1_Click(Index As Integer) 进给倍率选择Static beilvi As IntegerForm1.Label4.Caption = 运行正常Form1.Label39.Caption = 运行正常Select Case IndexCase 0 程序段点停止 JGpanduan = 0 进给判断 Image2(0).Visible = True For beilvi = 1 To 3 Image2(beilvi).Visible = False Next beilvi If fangshi = 0 Or fangshi = 1 Or fangshi = 2 Or fangshi = 3 Then 进给率变换判断 JGBLBH = 0 进给率变换参数 If jingeilvbh = False Then 如果只在自动方式下,还没有运行时,调节倍率 jingeibeilv = 0 End If Form2.Text1.Text = jingeibeilv 进给率显示 End If If fangshi = 4 Or fangshi = 5 Then jingeibeilv = 0 JGBLBH = 0 Form2.Text1.Text = jingeibeilv 进给率显示 End IfTimer10.Enabled = False If Timer2.Enabled = True Then Timer2.Enabled = False duandianbz = 1 End If If Timer3.Enabled = True Then Timer3.Enabled = False duandianbz = 2 End If If Timer4.Enabled = True Then Timer4.Enabled = False duandianbz = 3 End If If Timer5.Enabled = True Then Timer5.Enabled = False duandianbz = 4 End If If Timer6.Enabled = True Then Timer6.Enabled = False duandianbz = 5 End If If Timer7.Enabled = True Then Timer7.Enabled = False duandianbz = 6 End If If Timer8.Enabled = True Then Timer8.Enabled = False duandianbz = 7 End If If Timer9.Enabled = True Then Timer9.Enabled = False duandianbz = 8 End IfCase 1 -进给倍率50% JGpanduan = 1 进给判断 Image2(0).Visible = False Image2(1).Visible = True For beilvi = 2 To 3 Image2(beilvi).Visible = False Next beilvi jingeibeilv = 1 JGBLBH = jingeibeilv If fangshi = 0 Or fangshi = 1 Or fangshi = 2 Or fangshi = 3 Then 进给率变换判断 JGBLBH = 1 进给率变换参数 If jingeilvbh = False Then 如果只在自动方式下,还没有运行时,调节倍率 jingeibeilv = 1 End If Form2.Text1.Text = jingeibeilv 进给率显示 End If If fangshi = 4 Or fangshi = 5 Then JGBLBH = 1 jingeibeilv = 1 Form2.Text1.Text = jingeibeilv 进给率显示 End IfForm1.Label22.Caption = Val(Form1.Label24.Caption) * jingeibeilv / 2 实际进给量显示Form1.Label22.Caption = Format(Form1.Label22.Caption, #0.000)If jingeilvbh = True Then 进给倍率可以变换,防止点击后直接运行程序! If duandianbz 0 Then 是单段方式 If duandianbz = 1 Then 断点标志1 Timer2.Enabled = True End If If duandianbz = 2 Then Timer3.Enabled = True End If If duandianbz = 3 Then Timer4.Enabled = True End If If duandianbz = 4 Then Timer5.Enabled = True End If If duandianbz = 5 Then Timer6.Enabled = True End If If duandianbz = 6 Then Timer7.Enabled = True End If If duandianbz = 7 Then Timer8.Enabled = True End If If duandianbz = 8 Then Timer9.Enabled = True End If duandianbz = 0Else If cankaodian = False Then 回参判断 Form1.Label4.Caption = 没有回参考点! Form1.Label39.Caption = 没有回参考点!请点击回参考点按钮,进行回参考点操作! Exit Sub Else: Form1.Label4.Caption = 运行正常 Form1.Label39.Caption = 运行正常 End If If jingeibeilv = 0 Then 进给为零 zdyxbz = False Form1.Label4.Caption = 无法运行,进给率为0! Form1.Label39.Caption = 无法运行,进给率为0请调整进给倍率! Exit Sub Else: Form1.Label4.Caption = 运行正常 Form1.Label39.Caption = 运行正常 End IfIf fangshi = 0 And duandianbz = 0 Then -自动方式 zdyxbz = True 自动运行标志 If Form1.RichTB(0).Text = Then Form1.Label4.Caption = 请先选择加工程序! Form1.Label39.Caption = 请先选择加工程序! zdyxbz = False End Ifstr2 = ReadStringLine(Form1.RichTB(0).Text, 1) If Right(Trim(str2), 3) MPF Then Form1.Label4.Caption = 该程序不是有效的G代码程序! Form1.Label39.Caption = 该程序不是有效的G代码程序! Exit Sub Else: CODE14 = 0 允许程序运行 End If If zdyxbz = True Then Timer10.Enabled = True End IfEnd If If fangshi = 1 Then -单段方式 zdyxbz = True 自动运行标志 Timer10.Enabled = False If Form1.RichTB(0).Text = Then Form1.Label4.Caption = 请先选择加工程序! Form1.Label39.Caption = 请先选择加工程序! zdyxbz = False End If CODE14 = 0 允许程序运行 If zdyxbz = True Then chengxuzhix End If End If If fangshi = 2 Then -MDA方式 zdyxbz = True 自动运行标志 Timer10.Enabled = False CODE14 = 0 允许程序运行 If zdyxbz = True Then chengxuzhix End If End IfEnd IfEnd IfCase 2 -进给倍率100% JGpanduan = 2 进给判断 For beilvi = 0 To 1 Image2(beilvi).Visible = False Next beilvi Image2(2).Visible = True Image2(3).Visible = False If fangshi = 0 Or fangshi = 1 Or fangshi = 2 Or fangshi = 3 Then 进给率变换判断 JGBLBH = 2 进给率变换参数 If jingeilvbh = False Then 如果只在自动方式下,还没有运行时,调节倍率 jingeibeilv = 2 End If Form2.Text1.Text = jingeibeilv 进给率显示 End If If fangshi = 4 Or fangshi = 5 Then JGBLBH = 2 jingeibeilv = 2 Form2.Text1.Text = jingeibeilv 进给率显示 End If Form1.Label22.Caption = Val(Form1.Label24.Caption) * jingeibeilv / 2 实际进给量显示 Form1.Label22.Caption = Format(Form1.Label22.Caption, #0.000) If jingeilvbh = True Then 进给倍率可以变换,防止点击后直接运行程序! If duandianbz 0 Then 是单段方式 If duandianbz = 1 Then 断点标志1 Timer2.Enabled = True End If If duandianbz = 2 Then Timer3.Enabled = True End If If duandianbz = 3 Then Timer4.Enabled = True End If If duandianbz = 4 Then Timer5.Enabled = True End If If duandianbz = 5 Then Timer6.Enabled = True End If If duandianbz = 6 Then Timer7.Enabled = True End If If duandianbz = 7 Then Timer8.Enabled = True End If If duandianbz = 8 Then Timer9.Enabled = True End If duandianbz = 0Else If cankaodian = False Then 回参判断 Form1.Label4.Caption = 没有回参考点! Form1.Label39.Caption = 没有回参考点!请点击回参考点按钮,进行回参考点操作! Exit Sub Else: Form1.Label4.Caption = 运行正常 Form1.Label39.Caption = 运行正常 End If If jingeibeilv = 0 Then 进给为零 zdyxbz = False Form1.Label4.Caption = 无法运行,进给率为0! Form1.Label39.Caption = 无法运行,进给率为0请调整进给倍率! Exit Sub Else: Form1.Label4.Caption = 运行正常 Form1.Label39.Caption = 运行正常 End IfIf fangshi = 0 And duandianbz = 0 Then -自动方式 zdyxbz = True 自动运行标志 If Form1.RichTB(0).Text = Then Form1.Label4.Caption = 请先选择加工程序! Form1.Label39.Caption = 请先选择加工程序! zdyxbz = False End Ifstr2 = ReadStringLine(Form1.RichTB(0).Text, 1) If Right(Trim(str2), 3) MPF Then Form1.Label4.Caption = 该程序不是有效的G代码程序! Form1.Label39.Caption = 该程序不是有效的G代码程序! Exit Sub Else: CODE14 = 0 允许程序运行 End If If zdyxbz = True Then Timer10.Enabled = True End IfEnd If If fangshi = 1 Then -单段方式 zdyxbz = True 自动运行标志 Timer10.Enabled = False If Form1.RichTB(0).Text = Then Form1.Label4.Caption = 请先选择加工程序! Form1.Label39.Caption = 请先选择加工程序! zdyxbz = False End If CODE14 = 0 允许程序运行 If zdyxbz = True Then chengxuzhix End If End If If fangshi = 2 Then -MDA方式 zdyxbz = True 自动运行标志 Timer10.Enabled = False CODE14 = 0 允许程序运行 If zdyxbz = True Then chengxuzhix End If End IfEnd IfEnd IfCase 3 -进给倍率150% JGpanduan = 3 进给判断 Image2(3).Visible = True For beilvi = 0 To 2 Image2(beilvi).Visible = False Next beilvi If fangshi = 0 Or fangshi = 1 Or fangshi = 2 Or fangshi = 3 Then 进给率变换判断 JGBLBH = 3 进给率变换参数 If jingeilvbh = False Then 如果只在自动方式下,还没有运行时,调节倍率 jingeibeilv = 3 End If Form2.Text1.Text = jingeibeilv 进给率显示 End If If fangshi = 4 Or fangshi = 5 Then JGBLBH = 3 jingeibeilv = 3 Form2.Text1.Text = jingeibeilv 进给率显示 End If Form1.Label22.Caption = Val(Form1.Label24.Caption) * jingeibeilv / 2 实际进给量显示 Form1.Label22.Caption = Format(Form1.Label22.Caption, #0.000) If jingeilvbh = True Then 进给倍率可以变换,防止点击后直接运行程序! If duandianbz 0 Then 是单段方式 If duandianbz = 1 Then 断点标志1 Timer2.Enabled = True End If If duandianbz = 2 Then Timer3.Enabled = True End If If duandianbz = 3 Then Timer4.Enabled = True End If If duandianbz = 4 Then Timer5.Enabled = True End If If duandianbz = 5 Then Timer6.Enabled = True End If If duandianbz = 6 Then Timer7.Enabled = True End If If duandianbz = 7 Then Timer8.Enabled = True End If If duandianbz = 8 Then Timer9.Enabled = True End If duandianbz = 0Else If cankaodian = False Then 回参判断 Form1.Label4.Caption = 没有回参考点! Form1.Label39.Caption = 没有回参考点!请点击回参考点按钮,进行回参考点操作! Exit Sub Else: Form1.Label4.Caption = 运行正常 Form1.Label39.Caption = 运行正常 End If If jingeibeilv = 0 Then 进给为零 zdyxbz = False Form1.Label4.Caption = 无法运行,进给率为0! Form1.Label39.Caption = 无法运行,进给率为0请调整进给倍率! Exit Sub Else: Form1.Label4.Caption = 运行正常 Form1.Label39.Caption = 运行正常 End IfIf fangshi = 0 And duandianbz = 0 Then -自动方式 zdyxbz = True 自动运行标志 If Form1.RichTB(0).Text = Then Form1.Label4.Caption = 请先选择加工程序! Form1.Label39.Caption = 请先选择加工程序! zdyxbz = False End Ifstr2 = ReadStringLine(Form1.RichTB(0).Text, 1) If Right(Trim(str2), 3) MPF Then Form1.Label4.Caption = 该程序不是有效的G代码程序! Form1.Label39.Caption = 该程序不是有效的G代码程序! Exit Sub Else: CODE14 = 0 允许程序运行 End If If zdyxbz = True Then Timer10.Enabled = True End IfEnd If If fangshi = 1 Then -单段方式 zdyxbz = True 自动运行标志 Timer10.Enabled = False If Form1.RichTB(0).Text = Then Form1.Label4.Caption = 请先选择加工程序! Form1.Label39.Caption = 请先选择加工程序! zdyxbz = False End If CODE14 = 0 允许程序运行 If zdyxbz = True Then chengxuzhix End If End If If fangshi = 2 Then -MDA方式 zdyxbz = True 自动运行标志 Timer10.Enabled = False CODE14 = 0 允许程序运行 If zdyxbz = True Then chengxuzhix End If End IfEnd IfEnd IfEnd SelectEnd SubPrivate Sub Command33_Click()Static daojiai As IntegerIf daojiai = 0 ThenMDIForm1.Image01.Visible = FalsePicture7.BackColor = &H80FF80daojiai = daojiai + 1Else: MDIForm1.Image01.Visible = TruePicture7.BackColor = &H8000&daojiai = 0End IfEnd SubPrivate Sub Command36_Click() Static jizuobiaoi As IntegerIf jizuobiaoi = 0 Then Form1.Text4.Text = 工件坐标 Form2.Picture11.BackColor = &H80FF80 机床/工件坐标指示灯亮 If Form4.Option3(0).Value = True Then 1号刀具加工位置 Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text11(3).Text) - Val(Form1.Text11(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text11(1).Text) - Val(Form1.Text11(0).Text) 工件直径=X机床坐标+X磨损-X偏置 End If If Form4.Option3(1).Value = True Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text12(3).Text) - Val(Form1.Text12(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text12(1).Text) - Val(Form1.Text12(0).Text) 工件直径=X机床坐标+X磨损-X偏置 End If If Form4.Option3(2).Value = True Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text14(3).Text) - Val(Form1.Text14(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text14(1).Text) - Val(Form1.Text14(0).Text) 工件直径=X机床坐标+X磨损-X偏置 End If If Form4.Option3(3).Value = True Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text15(3).Text) - Val(Form1.Text15(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text15(1).Text) - Val(Form1.Text15(0).Text) 工件直径=X机床坐标+X磨损-X偏置 End If If Form4.Option3(4).Value = True Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text16(3).Text) - Val(Form1.Text16(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text16(1).Text) - Val(Form1.Text16(0).Text) 工件直径=X机床坐标+X磨损-X偏置 End If Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) jizuobiaoi = jizuobiaoi + 1Else: Form1.Text4.Text = 机床坐标 Form2.Picture11.BackColor = &H8000& 机床/工件坐标指示灯灭 Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 直径 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) jizuobiaoi = 0 End IfEnd SubPrivate Sub Command37_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 刀架四刀位换刀Picture10.BackColor = &H80FF80 换刀指示灯亮Static ihd As IntegerForm1.Label33.Caption = D1If ihd = 0 Then 刀位01 MDIForm1.UserC11.Left = MDIForm1.Image01.Left MDIForm1.UserC11.Top = MDIForm1.Image01.Top - 1140 MDIForm1.UserC21.Left = MDIForm1.Image01.Left If Form5.Text1.Text 0.00 Then 车削轴 MDIForm1.UserC21.Top = Val(Form5.Text1.Text) * 50 - MDIForm1.Image01.Top End If If Form5.Text3.Text 0.00 Then 孔类工件车削 MDIForm1.UserC21.Top = Val(Form5.Text3.Text) * 50 - MDIForm1.Image01.Top End If MDIForm1.UserC31.Left = 1200 MDIForm1.UserC31.Top = 6000 MDIForm1.UserC51.Left = 2280 MDIForm1.UserC51.Top = 6000 MDIForm1.UserC71.Left = 3120 MDIForm1.UserC71.Top = 6000 MDIForm1.UserC91.Left = 3480 MDIForm1.UserC91.Top = 6600 Form4.Option3(0).Value = True 刀具工作标志 Form4.Option3(1).Value = False Form4.Option3(2).Value = False Form4.Option3(3).Value = False Form4.Option3(4).Value = False Form1.Label31.Caption = T1 ihd = ihd + 1 ElseIf ihd = 1 Then 刀位02 MDIForm1.UserC31.Left = MDIForm1.Image01.Left MDIForm1.UserC31.Top = MDIForm1.Image01.Top - 1140 MDIForm1.UserC41.Left = MDIForm1.Image01.Left If Form5.Text1.Text 0.00 Then 车削轴 MDIForm1.UserC41.Top = Val(Form5.Text1.Text) * 50 - MDIForm1.Image01.Top End If If Form5.Text3.Text 0.00 Then 孔类工件车削 MDIForm1.UserC41.Top = Val(Form5.Text3.Text) * 50 - MDIForm1.Image01.Top End If MDIForm1.UserC11.Left = 240 MDIForm1.UserC11.Top = 6000 MDIForm1.UserC51.Left = 2280 MDIForm1.UserC51.Top = 6000 MDIForm1.UserC71.Left = 3120 MDIForm1.UserC71.Top = 6000 MDIForm1.UserC91.Left = 3480 MDIForm1.UserC91.Top = 6600 Form4.Option3(0).Value = False 刀具工作标志 Form4.Option3(1).Value = True Form4.Option3(2).Value = False Form4.Option3(3).Value = False Form4.Option3(4).Value = False Form1.Label31.Caption = T2 ihd = ihd + 1 ElseIf ihd = 2 Then 刀位03 MDIForm1.UserC51.Left = MDIForm1.Image01.Left MDIForm1.UserC51.Top = MDIForm1.Image01.Top - 1140 MDIForm1.UserC61.Left = MDIForm1.Image01.Left If Form5.Text1.Text 0.00 Then 车削轴 MDIForm1.UserC61.Top = Val(Form5.Text1.Text) * 50 - MDIForm1.Image01.Top End If If Form5.Text3.Text 0.00 Then 孔类工件车削 MDIForm1.UserC61.Top = Val(Form5.Text3.Text) * 50 - MDIForm1.Image01.Top End If MDIForm1.UserC11.Left = 240 MDIForm1.UserC11.Top = 6000 MDIForm1.UserC31.Left = 1200 MDIForm1.UserC31.Top = 6000 MDIForm1.UserC71.Left = 3120 MDIForm1.UserC71.Top = 6000 MDIForm1.UserC91.Left = 3480 MDIForm1.UserC91.Top = 6600 Form4.Option3(0).Value = False 刀具工作标志 Form4.Option3(1).Value = False Form4.Option3(2).Value = True Form4.Option3(3).Value = False Form4.Option3(4).Value = False Form1.Label31.Caption = T3 ihd = ihd + 1 ElseIf ihd = 3 Then 刀位04 MDIForm1.UserC71.Left = MDIForm1.Image01.Left MDIForm1.UserC71.Top = MDIForm1.Image01.Top - 1140 MDIForm1.UserC81.Left = MDIForm1.Image01.Left If Form5.Text1.Text 0.00 Then 车削轴 MDIForm1.UserC81.Top = Val(Form5.Text1.Text) * 50 - MDIForm1.Image01.Top End If If Form5.Text3.Text 0.00 Then 孔类工件车削 MDIForm1.UserC81.Top = Val(Form5.Text3.Text) * 50 - MDIForm1.Image01.Top End If MDIForm1.UserC31.Left = 1200 MDIForm1.UserC31.Top = 6000 MDIForm1.UserC51.Left = 2280 MDIForm1.UserC51.Top = 6000 MDIForm1.UserC11.Left = 240 MDIForm1.UserC11.Top = 6000 MDIForm1.UserC91.Left = 3480 MDIForm1.UserC91.Top = 6600 Form4.Option3(0).Value = False 刀具工作标志 Form4.Option3(1).Value = False Form4.Option3(2).Value = False Form4.Option3(3).Value = True Form4.Option3(4).Value = False Form1.Label31.Caption = T4 ihd = ihd + 1 Else 刀位05 MDIForm1.UserC91.Left = MDIForm1.Image01.Left - 1200 MDIForm1.UserC91.Top = MDIForm1.Image01.Top MDIForm1.UserC101.Left = MDIForm1.Image01.Left - 1200 If Form5.Text1.Text 0.00 Then 车削轴 MDIForm1.UserC101.Top = Val(Form5.Text1.Text) * 50 - MDIForm1.Image01.Top - 440 End If If Form5.Text3.Text 0.00 Then 孔类工件车削 MDIForm1.UserC101.Top = Val(Form5.Text3.Text) * 50 - MDIForm1.Image01.Top - 440 End If MDIForm1.UserC31.Left = 1200 MDIForm1.UserC31.Top = 6000 MDIForm1.UserC51.Left = 2280 MDIForm1.UserC51.Top = 6000 MDIForm1.UserC11.Left = 240 MDIForm1.UserC11.Top = 6000 MDIForm1.UserC71.Left = 3120 MDIForm1.UserC71.Top = 6000 Form4.Option3(0).Value = False 刀具工作标志 Form4.Option3(1).Value = False Form4.Option3(2).Value = False Form4.Option3(3).Value = False Form4.Option3(4).Value = True Form1.Label31.Caption = T5 ihd = 0End IfEnd SubPrivate Sub Command37_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) 刀架四刀位换刀Picture10.BackColor = &H8000& 机床/工件坐标指示灯灭End SubPrivate Sub Command39_Click(Index As Integer) 加工方式选择Static zlfsii As Integer zsd1(0).BackColor = &H8000& zsd1(1).BackColor = &H8000& zsd1(2).BackColor = &H8000& zsd1(3).BackColor = &H8000& zsd1(4).BackColor = &H8000& zsd1(5).BackColor = &H8000& Form1.Picture8.Visible = False 文件选择界面 Form1.Text8.Text = 增量x100不显示If Index = 0 Then fangshi = 0 自动方式 XZcmd40.Enabled = True XZcmd42.Enabled = True Form1.Text4.Text = 机床坐标 Form1.Label3.Caption = 自动 zsd1(Index).BackColor = &H80FF80ElseIf Index = 1 Thenfangshi = 1 单段XZcmd40.Enabled = TrueXZcmd42.Enabled = TrueForm1.Text4.Text = 机床坐标Form1.Label3.Caption = 单段zsd1(Index).BackColor = &H80FF80ElseIf Index = 2 Thenfangshi = 2 MDAXZcmd40.Enabled = TrueXZcmd42.Enabled = TrueForm1.Text6.SetFocus MDA输入获得焦点Asii = 6Form1.Text4.Text = 机床坐标Form1.Label3.Caption = MDAzsd1(Index).BackColor = &H80FF80ElseIf Index = 3 Thenfangshi = 3 增量方式XZcmd40.Enabled = TrueXZcmd42.Enabled = TrueForm1.Text4.Text = 机床坐标Form1.Label3.Caption = 增量zsd1(Index).BackColor = &H80FF80 If zlfsii = 0 Then Form1.Text8.Text = x1 jingeibeilv = 1 0%,50%,100%,150%,200% 进给率 JGBLBH = 1 zlfsii = zlfsii + 1 ElseIf zlfsii = 1 Then Form1.Text8.Text = x10 jingeibeilv = 2 0%,50%,100%,150%,200% 进给率 JGBLBH = 2 zlfsii = zlfsii + 1 ElseIf zlfsii = 2 Then Form1.Text8.Text = x100 jingeibeilv = 3 0%,50%,100%,150%,200% 进给率 JGBLBH = 3 zlfsii = zlfsii + 1 Else Form1.Text8.Text = x1000 系统默认倍率为1000 jingeibeilv = 4 0%,50%,100%,150%,200% 进给率 JGBLBH = 4 zlfsii = 0 End If Form2.Text1.Text = jingeibeilv 进给率显示ElseIf Index = 4 Thenfangshi = 4 手点动XZcmd40.Enabled = TrueXZcmd41.Enabled = TrueXZcmd42.Enabled = TrueXZcmd43.Enabled = TrueForm1.Text4.Text = 机床坐标Form1.Label3.Caption = 手动zsd1(Index).BackColor = &H80FF80ZouDao = 2Picture9.BackColor = &H8000&Else: fangshi = 5 手动REFXZcmd40.Enabled = FalseXZcmd42.Enabled = FalseForm1.Text4.Text = 参考点Form1.Label3.Caption = 手动REFzsd1(Index).BackColor = &H80FF80Picture11.BackColor = &H8000&jingeilvbh = False 进给倍率变换不可用End IfEnd SubPrivate Sub Command45_Click() 正转MDIForm1.Timer1.Enabled = TrueForm1.Timer1.Enabled = True SForm1.Timer3.Enabled = True SPIf MDIForm1.UserControl11.Left = Val(Form5.Text6.Text) * 50 - 300 Then Timer14.Enabled = True 顶尖转End IfEnd SubPrivate Sub Command46_Click() 停车MDIForm1.Timer1.Enabled = FalseMDIForm1.Timer2.Enabled = FalseForm1.Timer1.Enabled = False PForm1.Timer3.Enabled = False SPTimer14.Enabled = False 顶尖不转Form1.Label30.Caption = 0.000Form1.Text3.Text = 0.000End SubPrivate Sub Command47_Click() 反转MDIForm1.Timer2.Enabled = TrueForm1.Timer1.Enabled = True SForm1.Timer3.Enabled = True SPIf MDIForm1.UserControl11.Left = Val(Form5.Text6.Text) * 50 - 300 Then Timer14.Enabled = True 顶尖转End IfEnd SubPrivate Sub Command51_Click() 快进按钮If Form2.Timer10.Enabled = False And ZouDaoX = 0 And ZouDaoZ = 0 Then 程序运行时快进不能调节Static kuaijindengi, ip As IntegerIf kuaijindengi = 0 Then jingeibeilv = 4 0%,50%,100%,150%,200% 进给率 JGBLBH = 4 Form1.Label22.Caption = 0.500 Form1.Label22.Caption = Format(Form1.Label22.Caption, #0.000) Form1.Label24.Caption = 0.500 Form1.Label24.Caption = Format(Form1.Label24.Caption, #0.000) For ip = 0 To 3 进给按钮显示 Form2.Image2(ip).Visible = False Next ip Form2.Image2(3).Visible = True 进给按钮显示kuaijindengi = kuaijindengi + 1Else: jingeibeilv = 1 0%,50%,100%,150%,200% 进给率 JGBLBH = 1 Form1.Label22.Caption = 0.100 Form1.Label22.Caption = Format(Form1.Label22.Caption, #0.000) Form1.Label24.Caption = 0.100 Form1.Label24.Caption = Format(Form1.Label24.Caption, #0.000) For ip = 0 To 3 进给按钮显示 Form2.Image2(ip).Visible = False Next ip Form2.Image2(1).Visible = True 进给按钮显示kuaijindengi = 0End IfForm2.Text1.Text = jingeibeilv 进给率显示End IfEnd SubPrivate Sub Command54_Click() 急停MDIForm1.Timer1.Enabled = FalseMDIForm1.Timer2.Enabled = FalseTimer14.Enabled = False 顶尖停转Form1.Timer1.Enabled = FalseForm1.Timer3.Enabled = FalseForm1.Label30.Caption = 0.000Form1.Text3.Text = 0.000End SubPrivate Sub Timer15_Timer()Text2.Text = JGBLBHEnd SubPrivate Sub XZcmd40_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) -X移动If Form2.zsd1(4).BackColor = &H80FF80 Or Form2.zsd1(3).BackColor = &H80FF80 Then 手动方式4与增量方式3MDIForm1.Timer5.Enabled = TrueEnd IfEnd SubPrivate Sub XZcmd40_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) -X停止If Form2.zsd1(4).BackColor = &H80FF80 Or Form2.zsd1(3).BackColor = &H80FF80 ThenMDIForm1.Timer5.Enabled = FalseEnd IfEnd SubPrivate Sub XZcmd41_Click() 点击按钮X方向回参考点方式5If Form2.zsd1(5).BackColor = &H80FF80 ThenMDIForm1.Timer6.Enabled = TrueEnd IfEnd SubPrivate Sub XZcmd41_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) +X移动If Form2.zsd1(4).BackColor = &H80FF80 Or Form2.zsd1(3).BackColor = &H80FF80 ThenMDIForm1.Timer6.Enabled = TrueEnd IfEnd SubPrivate Sub XZcmd41_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) +X停止If Form2.zsd1(4).BackColor = &H80FF80 Or Form2.zsd1(3).BackColor = &H80FF80 ThenMDIForm1.Timer6.Enabled = FalseEnd IfEnd SubPrivate Sub XZcmd42_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) -Z移动If Form2.zsd1(4).BackColor = &H80FF80 Or Form2.zsd1(3).BackColor = &H80FF80 ThenMDIForm1.Timer3.Enabled = TrueEnd IfEnd SubPrivate Sub XZcmd42_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) -Z停止If Form2.zsd1(4).BackColor = &H80FF80 Or Form2.zsd1(3).BackColor = &H80FF80 ThenMDIForm1.Timer3.Enabled = FalseEnd IfEnd SubPrivate Sub XZcmd43_Click() 点击按钮Z方向回参考点方式5If Form2.zsd1(5).BackColor = &H80FF80 ThenMDIForm1.Timer4.Enabled = TrueEnd IfEnd SubPrivate Sub XZcmd43_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) +Z移动If Form2.zsd1(4).BackColor = &H80FF80 Or Form2.zsd1(3).BackColor = &H80FF80 ThenMDIForm1.Timer4.Enabled = TrueEnd IfEnd SubPrivate Sub XZcmd43_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) +Z停止If Form2.zsd1(4).BackColor = &H80FF80 Or Form2.zsd1(3).BackColor = &H80FF80 ThenMDIForm1.Timer4.Enabled = FalseEnd IfEnd Sub*Private Sub Timer9_Timer() %G33螺纹车削Static N As IntegerIf fangshi = 0 Or fangshi = 1 Or fangshi = 2 Then 单段或自动方式 Timer10.Enabled = False Timer9.Interval = 10 If pdgs = 0 Then f =0 If zmbz 0 Then L1, L4先走Z向 ZouDaoZ = 15 ZouDaoX = 0 Else: ZouDaoZ = -15 ZouDaoX = 0 End If pdgs = pdgs - Abs(xmbz / 0.3) P75公式F=F-ABS(Ye) Else f 0 Then L1, L2先走X向 ZouDaoX = 15 ZouDaoZ = 0 Else ZouDaoX = -15 ZouDaoZ = 0 End If pdgs = pdgs + Abs(zmbz / 0.3) P75公式F=F-ABS(Xe) End If DaoJiaShuiDi MDIForm1.UserC31.Move MDIForm1.UserC31.Left + ZouDaoZ, MDIForm1.UserC31.Top + ZouDaoX zdpd = zdpd - 1 P75公式Jz=Jz-1 N = N + 1 If N = 10 Then LuoWenDao1 螺纹刀 MDIForm1.UserC41.Move MDIForm1.UserC31.Left + ZouDaoZ, MDIForm1.UserC41.Top - ZouDaoX LuoWenDao2 螺纹刀隐形刀具 -为使螺纹槽图形完整,附加的程序 MDIForm1.Picture4.Line (MDIForm1.UserC31.Left + 105 + 150, MDIForm1.UserC31.Top - 5)-Step(-115, 900), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC31.Left + 115 + 150, MDIForm1.UserC31.Top - 10)-Step(115, 900), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC31.Left + 110 + 150, MDIForm1.UserC31.Top - 5)-Step(0, 900), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC41.Left + 110, MDIForm1.UserC41.Top + 1170)-Step(0, -900), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC31.Left + 210 + 150, MDIForm1.UserC31.Top + 180)-Step(0, 900), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC31.Left + 180 + 150, MDIForm1.UserC31.Top + 120)-Step(0, 900), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC31.Left + 220 + 150, MDIForm1.UserC31.Top + 200)-Step(0, 900), RGB(128, 255, 128) N = 0 End If If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text11(1).Text) - Val(Form1.Text11(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text12(3).Text) - Val(Form1.Text12(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) Else Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End If If zdpd = 0 Then f =0 If xmbz * zmbz 0 Then SR3 x方向走 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoX = 2 Case 2 ZouDaoX = 5 Case 3 ZouDaoX = 10 End Select ZouDaoZ = 0 ElseIf xmbz 0 Then SR2,SR4 If zmbz 0 Then SR2 Z方向走 ZouDaoX = 0 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoZ = 2 Case 2 ZouDaoZ = 5 Case 3 ZouDaoZ = 10 End Select ElseIf zmbz 0 Then SR4-Z方向走 ZouDaoX = 0 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoZ = -2 Case 2 ZouDaoZ = -5 Case 3 ZouDaoZ = -10 End Select End If pdgs = pdgs - 2 * Abs(JZS) + 1 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 JZS = Abs(JZS) - 0.04 Case 2 JZS = Abs(JZS) - 0.1 Case 3 JZS = Abs(JZS) - 0.2 End Select End IfElseIf pdgs 0 Then f0 If xmbz * zmbz 0 Then SR3-Z方向走 ZouDaoX = 0 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoZ = -2 Case 2 ZouDaoZ = -5 Case 3 ZouDaoZ = -10 End Select ElseIf xmbz 0 Then SR2, SR4 If zmbz 0 Then SR2 X方向走 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoX = 2 Case 2 ZouDaoX = 5 Case 3 ZouDaoX = 10 End Select ZouDaoZ = 0 ElseIf zmbz 0 Then SR4 -X方向走 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoX = -2 Case 2 ZouDaoX = -5 Case 3 ZouDaoX = -10 End Select ZouDaoZ = 0 End If pdgs = pdgs + 2 * Abs(JXS) + 1 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 JXS = Abs(JXS) + 0.04 Case 2 JXS = Abs(JXS) + 0.1 Case 3 JXS = Abs(JXS) + 0.2 End Select End IfEnd IfDaoJiaShuiDi 刀架,水滴移动 90偏刀(粗)If Form4.Option3(0).Value = True ThenMDIForm1.UserC11.Move MDIForm1.UserC11.Left + ZouDaoZ, MDIForm1.UserC11.Top + ZouDaoXPianDao1 90偏刀(粗)MDIForm1.UserC21.Move MDIForm1.UserC11.Left + ZouDaoZ, MDIForm1.UserC21.Top - ZouDaoXPianDao2 90偏刀(粗)隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text11(1).Text) - Val(Form1.Text11(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text11(3).Text) - Val(Form1.Text11(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(1).Value = True ThenMDIForm1.UserC31.Move MDIForm1.UserC31.Left + ZouDaoZ, MDIForm1.UserC31.Top + ZouDaoX 螺纹刀LuoWenDao1 螺纹刀MDIForm1.UserC41.Move MDIForm1.UserC31.Left + ZouDaoZ, MDIForm1.UserC41.Top - ZouDaoXLuoWenDao2 螺纹刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text12(1).Text) - Val(Form1.Text12(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text12(3).Text) - Val(Form1.Text12(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(2).Value = True ThenMDIForm1.UserC51.Move MDIForm1.UserC51.Left + ZouDaoZ, MDIForm1.UserC51.Top + ZouDaoX 精车刀JingCheDao1 精车刀MDIForm1.UserC61.Move MDIForm1.UserC51.Left + ZouDaoZ, MDIForm1.UserC61.Top - ZouDaoX 隐形刀具JingCheDao2 精车刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text14(1).Text) - Val(Form1.Text14(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text14(3).Text) - Val(Form1.Text14(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(3).Value = True ThenMDIForm1.UserC71.Move MDIForm1.UserC71.Left + ZouDaoZ, MDIForm1.UserC71.Top + ZouDaoX 切槽刀QieCaoDao1 切槽刀MDIForm1.UserC81.Move MDIForm1.UserC71.Left + ZouDaoZ, MDIForm1.UserC81.Top - ZouDaoX 隐形刀具QieCaoDao2 切槽刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text15(1).Text) - Val(Form1.Text15(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text15(3).Text) - Val(Form1.Text15(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(4).Value = True ThenMDIForm1.UserC91.Move MDIForm1.UserC91.Left + ZouDaoZ, MDIForm1.UserC91.Top + ZouDaoX 镗刀TangDao1 镗刀MDIForm1.UserC101.Move MDIForm1.UserC101.Left + ZouDaoZ, MDIForm1.UserC101.Top - ZouDaoX 隐形刀具TangDao2 镗刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text16(1).Text) - Val(Form1.Text16(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text16(3).Text) - Val(Form1.Text16(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form2.Picture11.BackColor = &H8000& Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000)End Ifzdpd = zdpd - 1If zdpd = 0 Then f =0If xmbz * zmbz 0 Then NR2、NR4If xmbz 0 Then NR4 x方向走 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoX = 2 Case 2 ZouDaoX = 5 Case 3 ZouDaoX = 10 End SelectZouDaoZ = 0 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 xmbz = xmbz - 0.04 Case 2 xmbz = xmbz - 0.1 Case 3 xmbz = xmbz - 0.2 End SelectElseIf xmbz 0 Then NR2 -x方向走 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoX = -2 Case 2 ZouDaoX = -5 Case 3 ZouDaoX = -10 End SelectZouDaoZ = 0 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 xmbz = xmbz + 0.04 Case 2 xmbz = xmbz + 0.1 Case 3 xmbz = xmbz + 0.2 End SelectEnd Ifpdgs = pdgs - 2 * Abs(JXS) + 1 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 JXS = Abs(JXS) - 0.04 Case 2 JXS = Abs(JXS) - 0.1 Case 3 JXS = Abs(JXS) - 0.2 End SelectElseIf xmbz * zmbz 0 Then NR3 Z方向走ZouDaoX = 0 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoZ = 2 Case 2 ZouDaoZ = 5 Case 3 ZouDaoZ = 10 End Select Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zmbz = zmbz - 0.04 Case 2 zmbz = zmbz - 0.1 Case 3 zmbz = zmbz - 0.2 End SelectElseIf zmbz 0 Then NR1一Z方向走ZouDaoX = 0Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoZ = -2 Case 2 ZouDaoZ = -5 Case 3 ZouDaoZ = -10 End Select Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zmbz = zmbz + 0.04 Case 2 zmbz = zmbz + 0.1 Case 3 zmbz = zmbz + 0.2 End SelectEnd Ifpdgs = pdgs - 2 * Abs(JZS) + 1 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 JZS = Abs(JZS) - 0.04 Case 2 JZS = Abs(JZS) - 0.1 Case 3 JZS = Abs(JZS) - 0.2 End SelectEnd IfElseIf pdgs 0 Then f 0 Then NR2、NR4If xmbz 0 Then NR4 +Z方向走ZouDaoX = 0 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoZ = 2 Case 2 ZouDaoZ = 5 Case 3 ZouDaoZ = 10 End Select Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zmbz = zmbz - 0.04 Case 2 zmbz = zmbz - 0.1 Case 3 zmbz = zmbz - 0.2 End SelectElseIf xmbz 0 Then NR2 -Z方向走ZouDaoX = 0 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoZ = -2 Case 2 ZouDaoZ = -5 Case 3 ZouDaoZ = -10 End Select Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zmbz = zmbz + 0.04 Case 2 zmbz = zmbz + 0.1 Case 3 zmbz = zmbz + 0.2 End SelectEnd Ifpdgs = pdgs + 2 * Abs(JZS) + 1 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 JZS = Abs(JZS) + 0.04 Case 2 JZS = Abs(JZS) + 0.1 Case 3 JZS = Abs(JZS) + 0.2 End SelectElseIf xmbz * zmbz 0 Then NR3 -X方向走 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoX = -2 Case 2 ZouDaoX = -5 Case 3 ZouDaoX = -10 End SelectZouDaoZ = 0 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 xmbz = xmbz + 0.04 Case 2 xmbz = xmbz + 0.1 Case 3 xmbz = xmbz + 0.2 End SelectElseIf zmbz 0 Then NR1 +X方向走Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoX = 2 Case 2 ZouDaoX = 5 Case 3 ZouDaoX = 10 End SelectZouDaoZ = 0 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 xmbz = xmbz - 0.04 Case 2 xmbz = xmbz - 0.1 Case 3 xmbz = xmbz - 0.2 End SelectEnd Ifpdgs = pdgs + 2 * Abs(JXS) + 1 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 JXS = Abs(JXS) + 0.04 Case 2 JXS = Abs(JXS) + 0.1 Case 3 JXS = Abs(JXS) + 0.2 End SelectEnd IfEnd IfDaoJiaShuiDi 刀架,水滴移动 90偏刀(粗)If Form4.Option3(0).Value = True ThenMDIForm1.UserC11.Move MDIForm1.UserC11.Left + ZouDaoZ, MDIForm1.UserC11.Top + ZouDaoXPianDao1 90偏刀(粗)MDIForm1.UserC21.Move MDIForm1.UserC11.Left + ZouDaoZ, MDIForm1.UserC21.Top - ZouDaoXPianDao2 90偏刀(粗)隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text11(1).Text) - Val(Form1.Text11(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text11(3).Text) - Val(Form1.Text11(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(1).Value = True ThenMDIForm1.UserC31.Move MDIForm1.UserC31.Left + ZouDaoZ, MDIForm1.UserC31.Top + ZouDaoX 螺纹刀LuoWenDao1 螺纹刀MDIForm1.UserC41.Move MDIForm1.UserC31.Left + ZouDaoZ, MDIForm1.UserC41.Top - ZouDaoXLuoWenDao2 螺纹刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text12(1).Text) - Val(Form1.Text12(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text12(3).Text) - Val(Form1.Text12(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(2).Value = True ThenMDIForm1.UserC51.Move MDIForm1.UserC51.Left + ZouDaoZ, MDIForm1.UserC51.Top + ZouDaoX 精车刀JingCheDao1 精车刀MDIForm1.UserC61.Move MDIForm1.UserC51.Left + ZouDaoZ, MDIForm1.UserC61.Top - ZouDaoX 隐形刀具JingCheDao2 精车刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text14(1).Text) - Val(Form1.Text14(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text14(3).Text) - Val(Form1.Text14(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(3).Value = True ThenMDIForm1.UserC71.Move MDIForm1.UserC71.Left + ZouDaoZ, MDIForm1.UserC71.Top + ZouDaoX 切槽刀QieCaoDao1 切槽刀MDIForm1.UserC81.Move MDIForm1.UserC71.Left + ZouDaoZ, MDIForm1.UserC81.Top - ZouDaoX 隐形刀具QieCaoDao2 切槽刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text15(1).Text) - Val(Form1.Text15(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text15(3).Text) - Val(Form1.Text15(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(4).Value = True ThenMDIForm1.UserC91.Move MDIForm1.UserC91.Left + ZouDaoZ, MDIForm1.UserC91.Top + ZouDaoX 镗刀TangDao1 镗刀MDIForm1.UserC101.Move MDIForm1.UserC101.Left + ZouDaoZ, MDIForm1.UserC101.Top - ZouDaoX 隐形刀具TangDao2 镗刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text16(1).Text) - Val(Form1.Text16(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text16(3).Text) - Val(Form1.Text16(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form2.Picture11.BackColor = &H8000& ThenForm1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2Form1.Text1.Text = Format(Form1.Text1.Text, #0.000)Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02Form1.Text2.Text = Format(Form1.Text2.Text, #0.000)End Ifzdpd = zdpd - 1If zdpd 0 Or pdgs = 0 Then f =0 If (zmbz = 0 And xmbz 0) Then +X Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoX = 2 Case 2 ZouDaoX = 5 Case 3 ZouDaoX = 10 End Select ZouDaoZ = 0 End If If (xmbz = 0 And zmbz 0) Then +Z Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoZ = 2 Case 2 ZouDaoZ = 5 Case 3 ZouDaoZ = 10 End Select ZouDaoX = 0 End If If zmbz 0 Then L1,L4先走Z向 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoZ = 2 Case 2 ZouDaoZ = 5 Case 3 ZouDaoZ = 10 End Select ZouDaoX = 0 Else L2,L3先走-Z向 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoZ = -2 Case 2 ZouDaoZ = -5 Case 3 ZouDaoZ = -10 End Select ZouDaoX = 0 End IfSelect Case jingeibeilv 进给率调整速率50,100,150。 Case 1 pdgs = pdgs - Abs(xmbz / 0.04) P75公式F=F-ABS(Xe) Case 2 pdgs = pdgs - Abs(xmbz / 0.1) P75公式F=F-ABS(Xe) Case 3 pdgs = pdgs - Abs(xmbz / 0.2) P75公式F=F-ABS(Xe) End SelectElse f 0 Then L1、L2先走X向 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoX = 2 Case 2 ZouDaoX = 5 Case 3 ZouDaoX = 10 End Select ZouDaoZ = 0 Else L3. L4先走一X向 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoX = -2 Case 2 ZouDaoX = -5 Case 3 ZouDaoX = -10 End Select ZouDaoZ = 0 End IfSelect Case jingeibeilv 进给率调整速率50,100,150。 Case 1 pdgs = pdgs + Abs(zmbz / 0.04) P75公式F=F+ABS(Ze) Case 2 pdgs = pdgs + Abs(zmbz / 0.1) P75公式F=F+ABS(Ze) Case 3 pdgs = pdgs + Abs(zmbz / 0.2) P75公式F=F+ABS(Ze) End SelectEnd IfIf Form5.Text1.Text 0.00 Then 轴类工件 If CODE13 1 And CODE13 2 Then 主轴没有旋转撞刀 If MDIForm1.Image01.Top = 1185 + Val(Form5.Text1.Text) * 50 And MDIForm1.Image01.Left = 30 + Val(Form5.Text6.Text) * 50 Then Form1.Label4.Caption = 主轴没有旋转撞刀 Form1.Label39.Caption = 主轴没有旋转撞刀 Timer7.Enabled = False Exit Sub End If End If MDIForm1.Picture4.Line (0, Val(Form5.Text1.Text) * 25)-Step(7000, 0), RGB(0, 0, 255) 划中心线 MDIForm1.Picture2.Line (0, Val(Form5.Text1.Text) * 25)-Step(7000, 0), RGB(0, 0, 255)ElseIf Form5.Text3.Text 0.00 Then 孔类工件 If CODE13 1 And CODE13 2 Then 主轴没有旋转撞刀 If MDIForm1.Image01.Top = 1185 + Val(Form5.Text3.Text) * 50 And MDIForm1.Image01.Left = 30 + Val(Form5.Text6.Text) * 50 Then Form1.Label4.Caption = 主轴没有旋转撞刀 Form1.Label39.Caption = 主轴没有旋转撞刀 Timer3.Enabled = False Exit Sub End If End If MDIForm1.Picture1.Line (0, Val(Form5.Text4.Text) * 25)-Step(7000, 0), RGB(0, 0, 255) 划中心线 MDIForm1.Picture2.Line (0, Val(Form5.Text3.Text) * 25)-Step(7000, 0), RGB(0, 0, 255)End IfForm1.Picture6.Visible = True X运行标志Form1.Picture7.Visible = True Z运行标志DaoJiaShuiDi 刀架,水滴移动 90偏刀(粗)If Form4.Option3(0).Value = True ThenMDIForm1.UserC11.Move MDIForm1.UserC11.Left + ZouDaoZ, MDIForm1.UserC11.Top + ZouDaoXPianDao1 90偏刀(粗)MDIForm1.UserC21.Move MDIForm1.UserC11.Left + ZouDaoZ, MDIForm1.UserC21.Top - ZouDaoXPianDao2 90偏刀(粗)隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text11(1).Text) - Val(Form1.Text11(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text11(3).Text) - Val(Form1.Text11(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(1).Value = True ThenMDIForm1.UserC31.Move MDIForm1.UserC31.Left + ZouDaoZ, MDIForm1.UserC31.Top + ZouDaoX 螺纹刀LuoWenDao1 螺纹刀MDIForm1.UserC41.Move MDIForm1.UserC31.Left + ZouDaoZ, MDIForm1.UserC41.Top - ZouDaoXLuoWenDao2 螺纹刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text12(1).Text) - Val(Form1.Text12(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text12(3).Text) - Val(Form1.Text12(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(2).Value = True ThenMDIForm1.UserC51.Move MDIForm1.UserC51.Left + ZouDaoZ, MDIForm1.UserC51.Top + ZouDaoX 精车刀JingCheDao1 精车刀MDIForm1.UserC61.Move MDIForm1.UserC51.Left + ZouDaoZ, MDIForm1.UserC61.Top - ZouDaoX 隐形刀具JingCheDao2 精车刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text14(1).Text) - Val(Form1.Text14(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text14(3).Text) - Val(Form1.Text14(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(3).Value = True ThenMDIForm1.UserC71.Move MDIForm1.UserC71.Left + ZouDaoZ, MDIForm1.UserC71.Top + ZouDaoX 切槽刀QieCaoDao1 切槽刀MDIForm1.UserC81.Move MDIForm1.UserC71.Left + ZouDaoZ, MDIForm1.UserC81.Top - ZouDaoX 隐形刀具QieCaoDao2 切槽刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text15(1).Text) - Val(Form1.Text15(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text15(3).Text) - Val(Form1.Text15(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form4.Option3(4).Value = True ThenMDIForm1.UserC91.Move MDIForm1.UserC91.Left + ZouDaoZ, MDIForm1.UserC91.Top + ZouDaoX 镗刀TangDao1 镗刀MDIForm1.UserC101.Move MDIForm1.UserC101.Left + ZouDaoZ, MDIForm1.UserC101.Top - ZouDaoX 隐形刀具TangDao2 镗刀隐形刀具 If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text16(1).Text) - Val(Form1.Text16(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text16(3).Text) - Val(Form1.Text16(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfEnd IfIf Form2.Picture11.BackColor = &H8000& ThenForm1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2Form1.Text1.Text = Format(Form1.Text1.Text, #0.000)Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02Form1.Text2.Text = Format(Form1.Text2.Text, #0.000)End Ifzdpd = zdpd - 1 P75公式Jz=Jz-1If zdpd = 0 Then ZouDaoX = 0 ZouDaoZ = 0 xmbz = 0 zmbz = 0 Timer6.Enabled = False Timer6.Interval = 0 jingeibeilv = JGBLBH 进给率变换参数赋值给jingeibeilv Form2.Text1.Text = jingeibeilv 进给率显示 Form1.Label22.Caption = Val(Form1.Label24.Caption) * jingeibeilv / 2 实际进给量显示 Form1.Label22.Caption = Format(Form1.Label22.Caption, #0.000) If fangshi = 0 Then Timer10.Enabled = True chengxuzhix()函数 ElseIf fangshi = 1 Or fangshi = 2 Then Timer10.Enabled = False End IfEnd IfEnd If If MDIForm1.Image01.Left -3845 Then X负向向超程解除ChaoCheng = 1 And(还没完成超程标) Form1.Label4.Caption = 运行正常 Form1.Label39.Caption = 运行正常 End If If MDIForm1.Image01.Top 800 Then Z负向向超程解除ChaoCheng = 1 And(还没完成超程标) Form1.Label4.Caption = 运行正常 Form1.Label39.Caption = 运行正常 End If If MDIForm1.Image01.Left = 9010 Then Form1.Label4.Caption = Z正向超程 Form1.Label39.Caption = Z正向超程请在手动方式下Z负向回程! Timer6.Enabled = False 超程标志 ChaoCheng = 1 Exit Sub End If If MDIForm1.Image01.Top = 8010 Then Form1.Label4.Caption = X正向超程 Form1.Label39.Caption = X正向超程请在手动方式下X负向回程! Timer6.Enabled = False 超程标志 ChaoCheng = 1 Exit Sub End If If MDIForm1.Image01.Left 9000 Then Z正向超程解除ChaoCheng = 1 And(还没完成超程标志) Form1.Label4.Caption = 运行正常 Form1.Label39.Caption = 运行正常 End IfEnd SubPrivate Sub Timer1_Timer() % G04If fangshi = 0 Or fangshi = 1 Or fangshi = 2 Then 单段或自动方式Timer10.Enabled = FalseTimer1.Interval = 1000 If G04CanShu 0 Then G04CanShu = G04CanShu - 1 Else Timer1.Enabled = False Timer1.Interval = 0 CODE3 = 0 代码复位 jingeibeilv = JGBLBH 进给率变换参数赋值给jingeibeilv Form2.Text1.Text = jingeibeilv 进给率显示 Form1.Label22.Caption = Val(Form1.Label24.Caption) * jingeibeilv / 2 实际进给量显示 Form1.Label22.Caption = Format(Form1.Label22.Caption, #0.000) If fangshi = 0 Then Timer10.Enabled = True chengxuzhix()函数 ElseIf fangshi = 1 Or fangshi = 2 Then Timer10.Enabled = False End If End IfEnd IfEnd SubPrivate Sub Timer2_Timer() %+XG00Timer10.Enabled = FalseTimer2.Interval = 5If CODE2 = 0 And xmbz 0 Then MDIForm1.Image01.Move MDIForm1.Image01.Left, MDIForm1.Image01.Top + ZouDaoX If Form4.Option3(0).Value = True Then 90粗车刀 MDIForm1.UserC11.Move MDIForm1.UserC11.Left, MDIForm1.UserC11.Top + ZouDaoX PianDao1 90偏刀(粗) MDIForm1.UserC21.Move MDIForm1.UserC11.Left, MDIForm1.UserC21.Top - ZouDaoX PianDao2 90偏刀(粗)隐形刀具 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 xmbz = xmbz - 8 * 0.02 Case 2 xmbz = xmbz - 10 * 0.02 Case 3 xmbz = xmbz - 15 * 0.02 End Select If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text11(1).Text) - Val(Form1.Text11(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End If End If If Form4.Option3(1).Value = True Then 螺纹刀 MDIForm1.UserC31.Move MDIForm1.UserC31.Left, MDIForm1.UserC31.Top + ZouDaoX 螺纹刀 LuoWenDao1 螺纹刀 MDIForm1.UserC41.Move MDIForm1.UserC41.Left, MDIForm1.UserC41.Top - ZouDaoX LuoWenDao2 螺纹刀隐形刀具 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 xmbz = xmbz - 8 * 0.02 Case 2 xmbz = xmbz - 10 * 0.02 Case 3 xmbz = xmbz - 15 * 0.02 End Select If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text12(1).Text) - Val(Form1.Text12(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End If End If If Form4.Option3(2).Value = True Then MDIForm1.UserC51.Move MDIForm1.UserC51.Left, MDIForm1.UserC51.Top + ZouDaoX 精车刀+X JingCheDao1 精车刀 MDIForm1.UserC61.Move MDIForm1.UserC61.Left, MDIForm1.UserC61.Top - ZouDaoX 隐形刀具 JingCheDao2 精车刀隐形刀具 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 xmbz = xmbz - 8 * 0.02 Case 2 xmbz = xmbz - 10 * 0.02 Case 3 xmbz = xmbz - 15 * 0.02 End Select If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text14(1).Text) - Val(Form1.Text14(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End If End If If Form4.Option3(3).Value = True Then 切槽刀加工 MDIForm1.UserC71.Move MDIForm1.UserC71.Left, MDIForm1.UserC71.Top + ZouDaoX 切槽刀+X QieCaoDao1 切槽刀 MDIForm1.UserC81.Move MDIForm1.UserC81.Left, MDIForm1.UserC81.Top - ZouDaoX 隐形刀具 QieCaoDao2 切槽刀隐形刀具 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 xmbz = xmbz - 8 * 0.02 Case 2 xmbz = xmbz - 10 * 0.02 Case 3 xmbz = xmbz - 15 * 0.02 End Select If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text15(1).Text) - Val(Form1.Text15(0).Text) 工件直径=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End If End If If Form4.Option3(4).Value = True Then MDIForm1.UserC91.Move MDIForm1.UserC91.Left, MDIForm1.UserC91.Top + ZouDaoX 镗刀 TangDao1 镗刀 MDIForm1.UserC101.Move MDIForm1.UserC101.Left, MDIForm1.UserC101.Top - ZouDaoX 隐形刀具 TangDao2 镗刀隐形刀具 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 xmbz = xmbz - 8 * 0.02 Case 2 xmbz = xmbz - 10 * 0.02 Case 3 xmbz = xmbz - 15 * 0.02 End Select If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 + Val(Form1.Text16(1).Text) - Val(Form1.Text16(0).Text) 工件长度=X机床坐标+X磨损-X偏置 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End If End If If Form2.Picture11.BackColor = &H8000& Then Form1.Text1.Text = (MDIForm1.Image01.Top - 8000) * 0.02 * 2 Form1.Text1.Text = Format(Form1.Text1.Text, #0.000) End IfElse: Timer2.Enabled = False Form1.Label22.Caption = Val(Form1.Label24.Caption) * jingeibeilv / 2 实际进给量显示 Form1.Label22.Caption = Format(Form1.Label22.Caption, #0.000) Timer2.Interval = 0 ZouDaoX = 0 xmbz = 0 Form1.Label47.Caption = 0 jingeibeilv = JGBLBH 进给率变换参数赋值给jingeibeilvEnd If If fangshi = 0 Then Timer10.Enabled = True ElseIf fangshi = 1 Or fangshi = 2 Then Timer10.Enabled = False End IfEnd SubPrivate Sub Timer3_Timer() %-XG00Timer10.Enabled = FalseTimer3.Interval = 5If CODE2 = 0 And xmbz 0 Then DaoJiaShuiDi01 刀架,水滴移动 If Form4.Option3(0).Value = True Then 90粗车刀 MDIForm1.UserC11.Move MDIForm1.UserC11.Left + ZouDaoZ, MDIForm1.UserC11.Top PianDao1 90偏刀(粗) MDIForm1.UserC21.Move MDIForm1.UserC11.Left + ZouDaoZ, MDIForm1.UserC21.Top PianDao2 90偏刀(粗)隐形刀具 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zmbz = zmbz - 8 * 0.02 Case 2 zmbz = zmbz - 10 * 0.02 Case 3 zmbz = zmbz - 15 * 0.02 End Select If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text11(3).Text) - Val(Form1.Text11(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End If End If If Form4.Option3(1).Value = True Then 螺纹刀 MDIForm1.UserC31.Move MDIForm1.UserC31.Left + ZouDaoZ, MDIForm1.UserC31.Top 螺纹刀 LuoWenDao1 螺纹刀 MDIForm1.UserC41.Move MDIForm1.UserC41.Left + ZouDaoZ, MDIForm1.UserC41.Top LuoWenDao2 螺纹刀隐形刀具 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zmbz = zmbz - 8 * 0.02 Case 2 zmbz = zmbz - 10 * 0.02 Case 3 zmbz = zmbz - 15 * 0.02 End Select If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text12(3).Text) - Val(Form1.Text12(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End If End If If Form4.Option3(2).Value = True Then MDIForm1.UserC51.Move MDIForm1.UserC51.Left + ZouDaoZ, MDIForm1.UserC51.Top 精车刀 JingCheDao1 精车刀 MDIForm1.UserC61.Move MDIForm1.UserC61.Left + ZouDaoZ, MDIForm1.UserC61.Top 隐形刀具 JingCheDao2 精车刀隐形刀具 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zmbz = zmbz - 8 * 0.02 Case 2 zmbz = zmbz - 10 * 0.02 Case 3 zmbz = zmbz - 15 * 0.02 End Select If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text14(3).Text) - Val(Form1.Text14(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End If End If If Form4.Option3(3).Value = True Then 切槽刀加工 MDIForm1.UserC71.Move MDIForm1.UserC71.Left + ZouDaoZ, MDIForm1.UserC71.Top 切槽刀 QieCaoDao1 切槽刀 MDIForm1.UserC81.Move MDIForm1.UserC81.Left + ZouDaoZ, MDIForm1.UserC81.Top 隐形刀具 QieCaoDao2 切槽刀隐形刀具 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zmbz = zmbz - 8 * 0.02 Case 2 zmbz = zmbz - 10 * 0.02 Case 3 zmbz = zmbz - 15 * 0.02 End Select If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text15(3).Text) - Val(Form1.Text15(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End If End If If Form4.Option3(4).Value = True Then MDIForm1.UserC91.Move MDIForm1.UserC91.Left + ZouDaoZ, MDIForm1.UserC91.Top 镗刀 TangDao1 镗刀 MDIForm1.UserC101.Move MDIForm1.UserC101.Left + ZouDaoZ, MDIForm1.UserC101.Top 隐形刀具 TangDao2 镗刀隐形刀具 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zmbz = zmbz - 8 * 0.02 Case 2 zmbz = zmbz - 10 * 0.02 Case 3 zmbz = zmbz - 15 * 0.02 End Select If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text16(3).Text) - Val(Form1.Text16(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End If End If If Form2.Picture11.BackColor = &H8000& Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfElse: Timer4.Enabled = False Timer4.Interval = 0 Form1.Label22.Caption = Val(Form1.Label24.Caption) * jingeibeilv / 2 实际进给量显示 Form1.Label22.Caption = Format(Form1.Label22.Caption, #0.000) ZouDaoZ = 0 zmbz = 0 Form1.Label51.Caption = 0 jingeibeilv = JGBLBH 进给率变换参数赋值给jingeibeilvEnd If If fangshi = 0 Then Timer10.Enabled = True ElseIf fangshi = 1 Or fangshi = 2 Then Timer10.Enabled = False End IfEnd SubPrivate Sub Timer5_Timer() %-ZG00Timer10.Enabled = FalseTimer5.Interval = 5If CODE2 = 0 And zmbz 0 Then DaoJiaShuiDi01 刀架,水滴移动 If Form4.Option3(0).Value = True Then 90粗车刀 MDIForm1.UserC11.Move MDIForm1.UserC11.Left + ZouDaoZ, MDIForm1.UserC11.Top PianDao1 90偏刀(粗) MDIForm1.UserC21.Move MDIForm1.UserC11.Left + ZouDaoZ, MDIForm1.UserC21.Top PianDao2 90偏刀(粗)隐形刀具 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zmbz = zmbz + 8 * 0.02 Case 2 zmbz = zmbz + 10 * 0.02 Case 3 zmbz = zmbz + 15 * 0.02 End Select If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text11(3).Text) - Val(Form1.Text11(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End If End If If Form4.Option3(1).Value = True Then 螺纹刀 MDIForm1.UserC31.Move MDIForm1.UserC31.Left + ZouDaoZ, MDIForm1.UserC31.Top 螺纹刀 LuoWenDao1 螺纹刀 MDIForm1.UserC41.Move MDIForm1.UserC41.Left + ZouDaoZ, MDIForm1.UserC41.Top LuoWenDao2 螺纹刀隐形刀具 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zmbz = zmbz + 8 * 0.02 Case 2 zmbz = zmbz + 10 * 0.02 Case 3 zmbz = zmbz + 15 * 0.02 End Select If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text12(3).Text) - Val(Form1.Text12(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End If End If If Form4.Option3(2).Value = True Then MDIForm1.UserC51.Move MDIForm1.UserC51.Left + ZouDaoZ, MDIForm1.UserC51.Top 精车刀 JingCheDao1 精车刀 MDIForm1.UserC61.Move MDIForm1.UserC61.Left + ZouDaoZ, MDIForm1.UserC61.Top 隐形刀具 JingCheDao2 精车刀隐形刀具 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zmbz = zmbz + 8 * 0.02 Case 2 zmbz = zmbz + 10 * 0.02 Case 3 zmbz = zmbz + 15 * 0.02 End Select If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text14(3).Text) - Val(Form1.Text14(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End If End If If Form4.Option3(3).Value = True Then 切槽刀加工 MDIForm1.UserC71.Move MDIForm1.UserC71.Left + ZouDaoZ, MDIForm1.UserC71.Top 切槽刀 QieCaoDao1 切槽刀 MDIForm1.UserC81.Move MDIForm1.UserC81.Left + ZouDaoZ, MDIForm1.UserC81.Top 隐形刀具 QieCaoDao2 切槽刀隐形刀具 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zmbz = zmbz + 8 * 0.02 Case 2 zmbz = zmbz + 10 * 0.02 Case 3 zmbz = zmbz + 15 * 0.02 End Select If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text15(3).Text) - Val(Form1.Text15(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End If End If If Form4.Option3(4).Value = True Then MDIForm1.UserC91.Move MDIForm1.UserC91.Left + ZouDaoZ, MDIForm1.UserC91.Top 镗刀 TangDao1 镗刀 MDIForm1.UserC101.Move MDIForm1.UserC101.Left + ZouDaoZ, MDIForm1.UserC101.Top 隐形刀具 TangDao2 镗刀隐形刀具 Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zmbz = zmbz + 8 * 0.02 Case 2 zmbz = zmbz + 10 * 0.02 Case 3 zmbz = zmbz + 15 * 0.02 End Select If Form2.Picture11.BackColor = &H80FF80 Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 + Val(Form1.Text16(3).Text) - Val(Form1.Text16(2).Text) 工件长度=Z机床坐标+Z磨损-Z偏置 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End If End If If Form2.Picture11.BackColor = &H8000& Then Form1.Text2.Text = (MDIForm1.Image01.Left - 9000) * 0.02 Form1.Text2.Text = Format(Form1.Text2.Text, #0.000) End IfElse: Timer5.Enabled = False Timer5.Interval = 0 Form1.Label22.Caption = Val(Form1.Label24.Caption) * jingeibeilv / 2 实际进给量显示 Form1.Label22.Caption = Format(Form1.Label22.Caption, #0.000) ZouDaoZ = 0 zmbz = 0 Form1.Label51.Caption = 0- jingeibeilv = JGBLBH 进给率变换参数赋值给jingeibeilvEnd If If fangshi = 0 Then Timer10.Enabled = True ElseIf fangshi = 1 Or fangshi = 2 Then Timer10.Enabled = False End IfEnd Sub* %1.循环启动、进给保持、复位Private Sub Command3_Click(Index As Integer) jingeilvbh = True 用于自动运行方式下调节倍率判断(此时运行) Form1.Picture6.Visible = True X运行标志 Form1.Picture7.Visible = True Z运行标志 Form1.Label2.Caption = 复位显示 If Form5.Text1.Text 0.00 Then 轴类工件 MDIForm1.Timer8.Enabled = True 划中心线 End IfSelect Case IndexCase 0 If duandianbz 0 Then 是单段方式 If duandianbz = 1 Then 断点标志1 Timer2.Enabled = True End If If duandianbz = 2 Then Timer3.Enabled = True End If If duandianbz = 3 Then Timer4.Enabled = True End If If duandianbz = 4 Then Timer5.Enabled = True End If If duandianbz = 5 Then Timer6.Enabled = True End If If duandianbz = 6 Then Timer7.Enabled = True End If If duandianbz = 7 Then Timer8.Enabled = True End If If duandianbz = 8 Then Timer9.Enabled = True End If duandianbz = 0 CODE10 = 0 M00M01复位Else If cankaodian = False Then 回参判断 Form1.Label4.Caption = 没有回参考点! Form1.Label39.Caption = 没有回参考点!请点击回参考点按钮,进行回参考点操作! Exit Sub Else: Form1.Label4.Caption = 运行正常 Form1.Label39.Caption = 运行正常 End If If jingeibeilv = 0 Then 进给为零 zdyxbz = False Form1.Label4.Caption = 无法运行,进给率为0! Form1.Label39.Caption = 无法运行,进给率为0请调整进给倍率! Exit Sub Else: Form1.Label4.Caption = 运行正常 Form1.Label39.Caption = 运行正常 End IfIf fangshi = 0 And duandianbz = 0 Then -自动方式 zdyxbz = True 自动运行标志 If Form1.RichTB(0).Text = Then Form1.Label4.Caption = 请先选择加工程序! Form1.Label39.Caption = 请先选择加工程序! zdyxbz = False End Ifstr2 = ReadStringLine(Form1.RichTB(0).Text, 1) If Right(Trim(str2), 3) MPF Then Form1.Label4.Caption = 该程序不是有效的G代码程序! Form1.Label39.Caption = 该程序不是有效的G代码程序! Exit Sub Else: CODE14 = 0 允许程序运行 End If If zdyxbz = True Then Timer10.Enabled = True End IfEnd If If fangshi = 1 Then -单段方式 zdyxbz = True 自动运行标志 Timer10.Enabled = False If Form1.RichTB(0).Text = Then Form1.Label4.Caption = 请先选择加工程序! Form1.Label39.Caption = 请先选择加工程序! zdyxbz = False End If CODE14 = 0 允许程序运行 If zdyxbz = True Then chengxuzhix End If End If If fangshi = 2 Then -MDA方式 zdyxbz = True 自动运行标志 Timer10.Enabled = False CODE14 = 0 允许程序运行 If zdyxbz = True Then chengxuzhix End If End IfEnd IfCase 1 程序段点停止 Timer10.Enabled = False If Timer2.Enabled = True Then Timer2.Enabled = False duandianbz = 1 End If If Timer3.Enabled = True Then Timer3.Enabled = False duandianbz = 2 End If If Timer4.Enabled = True Then Timer4.Enabled = False duandianbz = 3 End If If Timer5.Enabled = True Then Timer5.Enabled = False duandianbz = 4 End If If Timer6.Enabled = True Then Timer6.Enabled = False duandianbz = 5 End If If Timer7.Enabled = True Then Timer7.Enabled = False duandianbz = 6 End If If Timer8.Enabled = True Then Timer8.Enabled = False duandianbz = 7 End If If Timer9.Enabled = True Then Timer9.Enabled = False duandianbz = 8 End IfCase 2 复位 Form1.Cls 清除运行时在窗体上生成的图像或文本 Form1.Label2.Caption = 复位 CODE1 = 0: CODE2 = 0: CODE3 = 0: CODE4 = 0: CODE5 = 0 CODE6 = 0: CODE7 = 0: CODE8 = 0: CODE9 = 0: CODE10 = 0 CODE11 = 0: CODE12 = 0: CODE13 = 0: CODE14 = 0: CODE15 = 0 dataS = 0: dataI = 0: dataK = 0: dataR = 0: dataF = 0 DataX = 0: ataZ = 0: dataP = 0: xmbz = 0: zmbz = 0 imbz = 0: kmbz = 0: pdgs = 0: Pzdpd = 0 ni = 0: JXS = 0: JZS = 0: ZouDaoX = 0: ZouDaoZ = 0 chengxubz = 0: duandianbz = 0: Asii = 0 G97CanShu = 0: dataSii = 0: LIMS = 5000 Timer2.Enabled = False Timer3.Enabled = False Timer4.Enabled = False Timer5.Enabled = False Timer6.Enabled = False Timer7.Enabled = False Timer8.Enabled = False Timer9.Enabled = False Timer10.Enabled = False Select Case JGpanduan 进给判断 Case 0 jingeibeilv = 0 Case 1 jingeibeilv = 1 Case 2 jingeibeilv = 2 Case 3 jingeibeilv = 3 End Select Form2.Text1.Text = jingeibeilv 进给率显示End SelectEnd Sub %.Timer10Private Sub Timer10_Timer() 自动运行时行显示的切换时间chengxuzhixEnd Sub %3.chengxuzhix()Private Sub chengxuzhix() 自动运行时程序的读入与执行Dim str3 As StringStatic XunHuanCS, zcxchazhao As Integer 循环次数、子程序查找Static ZiFuHS As Integer 字符行数If Command3(0).Enabled = True Then zdyxbz = False 自动运行标志 Do Until UCase(str3) = M30 Or UCase(str3) = M02 Or UCase(Trim(str3) = RETURN 或者Do While UCase(str3) M30 Or UCase(str3) M02 Or UCase(Trim(str3) RETURN If chengxubz = 0 Then 执行或调转到主程序标志- str3 = ReadStringLine(Form1.RichTB(0).Text, ni) ElseIf chengxubz = 1 Then str3 = ReadStringLine(Form1.RichTB(1).Text, ni) End If - If ni = 1 Then Form1.Label5.Caption = str3 面板显示程序名 End If Form1.Text6.Text = str3 面板显示执行程序段 If Left(UCase(Trim(str3), 1) = _ Then If InStr(UCase(str3), P) = 0 Then ZiChengXu = Mid(str3, 2, 4) 获取子程序名 XunHuanCS = 1 Else: ZiChengXu = Mid(str3, 2, 4) XunHuanCS = Val(Right(str3, 1) End If -* For zcxchazhao = 0 To 4 子程序查找 str3 = ReadStringLine(Form1.RichTB1(zcxchazhao).Text, 1) If ZiChengXu = Left(UCase(Trim(str3), 4) Then Form1.RichTB(1).Text = Form1.RichTB1(zcxchazhao).Text End If Next zcxchazhao -* ZiFuHS = ni ni = 0 chengxubz = 1 调转到子程序标志 End If If chengxubz = 1 Then -# If UCase(Trim(str3) = RETURN Then If XunHuanCS 1 Then XunHuanCS = XunHuanCS - 1 ni = 0 str3 = chengxubz = 1 ElseIf XunHuanCS = 1 Then ni = ZiFuHS chengxubz = 0 End If End If End If -# DaiMaWenJian = FreeFile 代码文件 Open e:mdifile.txt For Output As #DaiMaWenJian Print #DaiMaWenJian, Trim(UCase(str3) Close #DaiMaWenJian DaiMaWenJian = FreeFile Open e:mdifile.txt For Input As #1 chengxuchuli Close #1 yimachengxu Form1.Label47.Caption = ni L行号 If fangshi = 0 Then If CODE10 = 0 Then M00M01不动作判断 Timer10.Enabled = True Else: Timer10.Enabled = False End If ni = ni + 1 ElseIf fangshi = 1 Then ni = ni + 1 Timer10.Enabled = False ElseIf fangshi = 2 Then MDA ni = 1 Timer10.Enabled = False End If Exit Do LoopElse: Exit SubEnd IfEnd Sub %4.代码识别VB源程序:Private Sub chengxuchuli()Dim Gxx, Sss As IntegerDim Mxx, Txx, Sxx, Pxx, pd, NewWenJian As StringDim Xno, Zno, Ino, Kno, Rno As BooleanOn Error Resume Nextzdyxbz = FalseXno = True X无数据输入Zno = True X无数据输入Ino = TrueKno = TrueRno = TrueDo Until EOF(1)NewWenJian = Input$(1, #1)Form1.Text18.Text = Select Case NewWenJian Case GGH:Gxx = Input$(2, #1)Select Case GxxCase 00CODE2 = 0Form1.Text13(7).Text = GxxCase 01CODE2 = 1Form1.Text13(7).Text = GxxCase 02CODE2 = 2Form1.Text13(7).Text = GxxCase 03CODE2 = 3Form1.Text13(7).Text = GxxCase 33 螺纹插补CODE2 = 4Form1.Text13(7).Text = GxxCase 90CODE1 = 0Form1.Text13(10).Text = GxxCase 91CODE1 = 1Form1.Text13(10).Text = GxxCase 21 公制CODE12 = 0Form1.Text13(9).Text = GxxCase 20 英制CODE12 = 1Form1.Text13(9).Text = GxxCase 94 每分钟进给CODE7 = 1Form1.Text13(11).Text = GxxCase 95 每转进给CODE7 = 0Form1.Text13(11).Text = GxxCase 23 直径CODE5 = 0ZhiJing = 2Form1.Text13(12).Text = GxxCase 22 半径CODE5 = 1ZhiJing = 1Form1.Text13(12).Text = GxxCase 96 恒线速CODE8 = 1Form1.Text13(13).Text = GxxdataSii = dataSG97CanShu = Val(MDIForm1.Image01.Top - 8000) * 0.02 * 2) + Val(Form1.Text11(1).Text) - Val(Form1.Text11(0).Text) 转速起始值Case 97 恒转速CODE8 = 0G96CanShu = 1dataS = dataSiiForm1.Text13(13).Text = GxxCase 15 G158偏移坐标系CODE6 = 1Case 04 暂停CODE3 = 1Case 25 主轴转速下限CODE11 = 1Case 26 主轴转速上限CODE11 = 2End SelectCase MMH:Mxx = Input$(2, #1)Form1.Text13(14).Text = MxxIf Mxx = 05 ThenCODE13 = 0Form1.Text13(15).Text = ElseIf Mxx = 03 ThenCODE13 = 1Form1.Text13(15).Text = SxxElseIf Mxx = 04 ThenCODE13 = 2ElseIf Mxx = 08 ThenCODE9 = 1ElseIf Mxx = 09 ThenCODE9 = 2ElseIf Mxx = 30 Or Mxx = 02 ThenCODE14 = 1Form1.Text13(17).Text = Form1.Text13(18).Text = Form1.Text13(19).Text = Form1.Text13(20).Text = Form1.Text13(21).Text = Form1.Text13(22).Text = ElseIf Mxx = RETURN ThenCODE14 = 2ElseIf Mxx = 00 Or Mxx = 01 Then 程序暂停CODE10 = 1ElseEnd IfCase TTH:Txx = Input$(1, #1)Form1.Text13(16).Text = TxxIf Txx = 1 Then CODE15 = 1If Txx = 2 Then CODE15 = 2If Txx = 3 Then CODE15 = 3If Txx = 4 Then CODE15 = 4If Txx = 5 Then CODE15 = 5Txx = Input$(2, #1)Form1.Text13(16).Text = TxxIf Left(Txx, 2) = 01 Then CODE15 = 1If Left(Txx, 2) = 02 Then CODE15 = 2If Left(Txx, 2) = 03 Then CODE15 = 3If Left(Txx, 2) = 04 Then CODE15 = 4If Left(Txx, 2) = 05 Then CODE15 = 5Case SSH:Sxx = Input$(4, #1)If CODE13 0 Then If CODE11 = 1 Then 主轴转速下限 If dataS Val(Sxx) Then dataS = Val(Sxx) Else: dataS = Val(Sxx) End If CODE11 = 0 End If If CODE11 = 0 Then 主轴转速没有限制 dataS = Val(Sxx) End IfForm1.Text13(15).Text = dataS -End IfCase XXH:Form1.Text18.Text = Xno = FalseDo Until EOF(1)pd = Input$(1, #1)If pd = Z Then GoTo ZHIf pd = F Then GoTo FHIf pd = M Then GoTo MHIf pd = S Then GoTo SHIf pd = G Then GoTo GHIf pd = T Then GoTo THIf pd = I Then GoTo IHIf pd = K Then GoTo KHIf pd = R Then GoTo RHIf pd = P Then GoTo PHIf pd = + Or pd = - ThenForm1.Text18.Text = Form1.Text18.Text & pdElseIf pd = 9 Or pd = 8 Or pd = 7 Or pd = 6 Or pd = 5 Or pd = 4 Or pd = 3 Or pd = 2 Or pd = 1 Or pd = 0 Or pd = . ThenForm1.Text18.Text = Form1.Text18.Text & pdEnd IfForm1.Text13(17).Text = Form1.Text18.TextDataX = Format(Form1.Text13(17).Text, #0.000)If CODE6 = 1 Then G158的X偏移量(直径值) N158X = DataXEnd IfLoopCase ZZH:Form1.Text18.Text = Zno = FalseDo Until EOF(1)pd = Input$(1, #1)If pd = X Then GoTo ZHIf pd = F Then GoTo FHIf pd = M Then GoTo MHIf pd = S Then GoTo SHIf pd = T Then GoTo THIf pd = I Then GoTo IHIf pd = K Then GoTo KHIf pd = R Then GoTo RHIf pd = P Then GoTo PHIf pd = + Or pd = - ThenForm1.Text18.Text = Form1.Text18.Text & pdElseIf pd = 9 Or pd = 8 Or pd = 7 Or pd = 6 Or pd = 5 Or pd = 4 Or pd = 3 Or pd = 2 Or pd = 1 Or pd = 0 Or pd = . ThenForm1.Text18.Text = Form1.Text18.Text & pdEnd IfForm1.Text13(18).Text = Form1.Text18.TextDataZ = Format(Form1.Text13(18).Text, #0.000)If CODE6 = 1 Then G158的Z偏移量 N158Z = DataZEnd IfLoopCase P -&PH:Form1.Text18.Text = Xno = FalseDo Until EOF(1)pd = Input$(1, #1)If pd = X Then GoTo ZHIf pd = Z Then GoTo ZHIf pd = F Then GoTo FHIf pd = M Then GoTo MHIf pd = S Then GoTo SHIf pd = G Then GoTo GHIf pd = T Then GoTo THIf pd = I Then GoTo IHIf pd = K Then GoTo KHIf pd = R Then GoTo RHIf pd = + Or pd = - ThenForm1.Text18.Text = Form1.Text18.Text & pdElseIf pd = 9 Or pd = 8 Or pd = 7 Or pd = 6 Or pd = 5 Or pd = 4 Or pd = 3 Or pd = 2 Or pd = 1 Or pd = 0 Or pd = . ThenForm1.Text18.Text = Form1.Text18.Text & pdEnd IfForm1.Text13(0).Text = Form1.Text18.TextdataP = Format(Form1.Text13(0).Text, #0.000)G04CanShu = Val(Form1.Text13(0).Text)LoopCase IIH:Form1.Text18.Text = Ino = FalseDo Until EOF(1)pd = Input$(1, #1)If pd = F Then GoTo FHIf pd = M Then GoTo MHIf pd = S Then GoTo SHIf pd = T Then GoTo THIf pd = K Then GoTo KHIf pd = R Then GoTo RHIf pd = P Then GoTo PHIf pd = + Or pd = - ThenForm1.Text18.Text = Form1.Text18.Text & pdElseIf pd = 9 Or pd = 8 Or pd = 7 Or pd = 6 Or pd = 5 Or pd = 4 Or pd = 3 Or pd = 2 Or pd = 1 Or pd = 0 Or pd = . ThenForm1.Text18.Text = Form1.Text18.Text & pdEnd IfForm1.Text13(19).Text = Form1.Text18.TextdataI = Format(Form1.Text13(19).Text, #0.000)LoopCase KKH:Form1.Text18.Text = Kno = FalseDo Until EOF(1)pd = Input$(1, #1)If pd = F Then GoTo FHIf pd = M Then GoTo MHIf pd = S Then GoTo SHIf pd = T Then GoTo THIf pd = I Then GoTo IHIf pd = R Then GoTo RHIf pd = P Then GoTo PHIf pd = + Or pd = - ThenForm1.Text18.Text = Form1.Text18.Text & pdElseIf pd = 9 Or pd = 8 Or pd = 7 Or pd = 6 Or pd = 5 Or pd = 4 Or pd = 3 Or pd = 2 Or pd = 1 Or pd = 0 Or pd = . ThenForm1.Text18.Text = Form1.Text18.Text & pdEnd IfForm1.Text13(21).Text = Form1.Text18.TextdataK = Format(Form1.Text13(21).Text, #0.000)LoopCase RRH:Form1.Text18.Text = Rno = FalseDo Until EOF(1)pd = Input$(1, #1)If pd = F Then GoTo FHIf pd = M Then GoTo MHIf pd = S Then GoTo SHIf pd = T Then GoTo THIf pd = P Then GoTo PHIf pd = + Or pd = - ThenForm1.Text18.Text = Form1.Text18.Text & pdElseIf pd = 9 Or pd = 8 Or pd = 7 Or pd = 6 Or pd = 5 Or pd = 4 Or pd = 3 Or pd = 2 Or pd = 1 Or pd = 0 Or pd = . ThenForm1.Text18.Text = Form1.Text18.Text & pdEnd IfForm1.Text13(22).Text = Form1.Text18.TextdataR = Format(Form1.Text13(22).Text, #0.000)LoopCase FFH:Form1.Text18.Text = Do Until EOF(1)pd = Input$(1, #1)If pd = X Then GoTo ZH -If pd = Z Then GoTo ZHIf pd = M Then GoTo MHIf pd = S Then GoTo SHIf pd = G Then GoTo GHIf pd = T Then GoTo THIf pd = I Then GoTo IHIf pd = K Then GoTo KHIf pd = R Then GoTo RHIf pd = M Then GoTo MH -If pd = S Then GoTo SHIf pd = T Then GoTo THIf pd = P Then GoTo PHIf pd = 9 Or pd = 8 Or pd = 7 Or pd = 6 Or pd = 5 Or pd = 4 Or pd = 3 Or pd = 2 Or pd = 1 Or pd = 0 Or pd = . ThenForm1.Text18.Text = Form1.Text18.Text & pdElse: End If Form1.Label24.Caption = Form1.Text18.Text Form1.Label24.Caption = Format(Form1.Label24.Caption, #0.000) Form1.Label22.Caption = Val(Form1.Text18.Text) * jingeibeilv / 2 Form1.Label22.Caption = Format(Form1.Label22.Caption, #0.000)dataF = Format(Form1.Text18.Text, #0.000)LoopCase LLH:Form1.Text18.Text = Do Until EOF(1)pd = Input$(3, #1)If pd = IMS Then Do Until EOF(1) pd = Input$(1, #1) If pd = 9 Or pd = 8 Or pd = 7 Or pd = 6 Or pd = 5 Or pd = 4 Or pd = 3 Or pd = 2 Or pd = 1 Or pd = 0 Or pd = . Then Form1.Text18.Text = Form1.Text18.Text & pd End If LoopEnd IfForm1.Text13(1).Text = Form1.Text18.TextLIMS = Format(Form1.Text13(1).Text, #0.000)LoopEnd SelectIf Xno = True And CODE1 = 1 Then Form1.Text13(17).Text = 0If Zno = True And CODE1 = 1 Then Form1.Text13(18).Text = 0If Ino = True And CODE1 = 1 Then Form1.Text13(19).Text = 0If Kno = True And CODE1 = 1 Then Form1.Text13(21).Text = 0If Rno = True And CODE1 = 1 Then Form1.Text13(22).Text = 0LoopEnd Sub Private Sub yimachengxu() %5.功能码译码并执行VB源程序:If CODE14 = 1 Then ni = 0 Timer10.Enabled = False MDIForm1.Timer8.Enabled = False 划中心线 MDIForm1.Timer1.Enabled = False MDIForm1.Timer2.Enabled = False Form1.Timer1.Enabled = False Form1.Timer3.Enabled = False Form1.Text3.Text = 0 MDIForm1.Timer11.Enabled = False 水龙头有、流水开-流水停 MDIForm1.UserC1.Visible = False MDIForm1.UserC2.Visible = False MDIForm1.UserC4.Visible = False MDIForm1.UserC3.Visible = False MDIForm1.UserC5.Visible = False MDIForm1.UserC6.Visible = False Picture9.BackColor = &HFF& 红 Exit SubEnd IfIf CODE15 = 1 Then 刀位01 MDIForm1.UserC11.Left = MDIForm1.Image01.Left MDIForm1.UserC11.Top = MDIForm1.Image01.Top - 1140 MDIForm1.UserC21.Left = MDIForm1.Image01.Left If Form5.Text3.Text 0.00 Then 轴类工件车削 MDIForm1.UserC21.Top = Val(Form5.Text1.Text) * 50 - MDIForm1.Image01.Top End If If Form5.Text3.Text 0.00 Then 孔类工件车削 MDIForm1.UserC21.Top = Val(Form5.Text3.Text) * 50 - MDIForm1.Image01.Top End If MDIForm1.UserC31.Left = 1200 MDIForm1.UserC31.Top = 6000 MDIForm1.UserC51.Left = 2280 MDIForm1.UserC51.Top = 6000 MDIForm1.UserC71.Left = 3120 MDIForm1.UserC71.Top = 6000 MDIForm1.UserC91.Left = 3480 MDIForm1.UserC91.Top = 6600 Form4.Option3(0).Value = True 刀具工作标志 Form4.Option3(1).Value = False Form4.Option3(2).Value = False Form4.Option3(3).Value = False Form4.Option3(4).Value = False Form1.Label31.Caption = T1 Form1.Label33.Caption = D1ElseIf CODE15 = 2 Then 刀位02 MDIForm1.UserC31.Left = MDIForm1.Image01.Left MDIForm1.UserC31.Top = MDIForm1.Image01.Top - 1140 MDIForm1.UserC41.Left = MDIForm1.Image01.Left If Form5.Text3.Text 0.00 Then 轴类工件车削 MDIForm1.UserC41.Top = Val(Form5.Text1.Text) * 50 - MDIForm1.Image01.Top End If If Form5.Text3.Text 0.00 Then 孔类工件车削 MDIForm1.UserC41.Top = Val(Form5.Text3.Text) * 50 - MDIForm1.Image01.Top End If MDIForm1.UserC11.Left = 240 MDIForm1.UserC11.Top = 6000 MDIForm1.UserC51.Left = 2280 MDIForm1.UserC51.Top = 6000 MDIForm1.UserC71.Left = 3120 MDIForm1.UserC71.Top = 6000 MDIForm1.UserC91.Left = 3480 MDIForm1.UserC91.Top = 6600 Form4.Option3(0).Value = False 刀具工作标志 Form4.Option3(1).Value = True Form4.Option3(2).Value = False Form4.Option3(3).Value = False Form4.Option3(4).Value = False Form1.Label31.Caption = T2 Form1.Label33.Caption = D1ElseIf CODE15 = 3 Then 刀位03 MDIForm1.UserC51.Left = MDIForm1.Image01.Left MDIForm1.UserC51.Top = MDIForm1.Image01.Top - 1140 MDIForm1.UserC61.Left = MDIForm1.Image01.Left If Form5.Text3.Text 0.00 Then 轴类工件车削 MDIForm1.UserC61.Top = Val(Form5.Text1.Text) * 50 - MDIForm1.Image01.Top End If If Form5.Text3.Text 0.00 Then 孔类工件车削 MDIForm1.UserC61.Top = Val(Form5.Text3.Text) * 50 - MDIForm1.Image01.Top End If MDIForm1.UserC11.Left = 240 MDIForm1.UserC11.Top = 6000 MDIForm1.UserC31.Left = 1200 MDIForm1.UserC31.Top = 6000 MDIForm1.UserC71.Left = 3120 MDIForm1.UserC71.Top = 6000 MDIForm1.UserC91.Left = 3480 MDIForm1.UserC91.Top = 6600 Form4.Option3(0).Value = False 刀具工作标志 Form4.Option3(1).Value = False Form4.Option3(2).Value = True Form4.Option3(3).Value = False Form4.Option3(4).Value = False Form1.Label31.Caption = T3 Form1.Label33.Caption = D1ElseIf CODE15 = 4 Then 刀位04 MDIForm1.UserC71.Left = MDIForm1.Image01.Left MDIForm1.UserC71.Top = MDIForm1.Image01.Top - 1140 MDIForm1.UserC81.Left = MDIForm1.Image01.Left If Form5.Text3.Text 0.00 Then 轴类工件车削 MDIForm1.UserC81.Top = Val(Form5.Text1.Text) * 50 - MDIForm1.Image01.Top End If If Form5.Text3.Text 0.00 Then 孔类工件车削 MDIForm1.UserC81.Top = Val(Form5.Text3.Text) * 50 - MDIForm1.Image01.Top End If MDIForm1.UserC31.Left = 1200 MDIForm1.UserC31.Top = 6000 MDIForm1.UserC51.Left = 2280 MDIForm1.UserC51.Top = 6000 MDIForm1.UserC11.Left = 240 MDIForm1.UserC11.Top = 6000 MDIForm1.UserC91.Left = 3480 MDIForm1.UserC91.Top = 6600 Form4.Option3(0).Value = False 刀具工作标志 Form4.Option3(1).Value = False Form4.Option3(2).Value = False Form4.Option3(3).Value = True Form4.Option3(4).Value = False Form1.Label31.Caption = T4 Form1.Label33.Caption = D1ElseIf CODE15 = 5 Then 刀位05 MDIForm1.UserC91.Left = MDIForm1.Image01.Left - 1200 MDIForm1.UserC91.Top = MDIForm1.Image01.Top MDIForm1.UserC101.Left = MDIForm1.Image01.Left - 1200 If Form5.Text3.Text 0.00 Then 轴类工件车削 MDIForm1.UserC101.Top = Val(Form5.Text1.Text) * 50 - MDIForm1.Image01.Top - 440 End If If Form5.Text3.Text 0.00 Then 孔类工件车削 MDIForm1.UserC101.Top = Val(Form5.Text3.Text) * 50 - MDIForm1.Image01.Top - 440 End If MDIForm1.UserC31.Left = 1200 MDIForm1.UserC31.Top = 6000 MDIForm1.UserC51.Left = 2280 MDIForm1.UserC51.Top = 6000 MDIForm1.UserC11.Left = 240 MDIForm1.UserC11.Top = 6000 MDIForm1.UserC71.Left = 3120 MDIForm1.UserC71.Top = 6000 Form4.Option3(0).Value = False 刀具工作标志 Form4.Option3(1).Value = False Form4.Option3(2).Value = False Form4.Option3(3).Value = False Form4.Option3(4).Value = True Form1.Label31.Caption = T5 Form1.Label33.Caption = D1End Ifzdyxbz = FalseIf CODE1 = 1 Or CODE1 = 0 Then G91、G90 If Form1.Text13(19).Text = Or Form1.Text13(19).Text = 0 Then imbz = 0 Else imbz = Val(Form1.Text13(19).Text) End If If Form1.Text13(21).Text = Or Form1.Text13(21).Text = 0 Then kmbz = 0 Else kmbz = Val(Form1.Text13(21).Text) End IfEnd IfIf CODE1 = 1 Then G91 If Form1.Text13(17).Text = Or Form1.Text13(17).Text = 0 Then xmbz = 0 Else xmbz = Val(Form1.Text13(17).Text) / 2 End If If Form1.Text13(18).Text = Or Form1.Text13(18).Text = 0 Then zmbz = 0 Else zmbz = Val(Form1.Text13(18).Text) End IfDataX = MDIForm1.UserC11.Top 当前点的坐标DataZ = MDIForm1.UserC11.Left 当前点的坐标JXS = Abs(Val(Form1.Text13(19).Text) IJZS = Abs(Val(Form1.Text13(21).Text) KElseIf CODE1 = 0 Then G90 If Form1.Text13(17).Text = Or Form1.Text13(17).Text = 0 Then xmbz = 0 Else If CODE15 = 1 Then xmbz = (Val(Form1.Text13(17).Text) - (Val(MDIForm1.Image01.Top - 8000) * 0.02 * 2) + Val(Form1.Text11(1).Text) - Val(Form1.Text11(0).Text) / ZhiJing 增量 ElseIf CODE15 = 2 Then xmbz = (Val(Form1.Text13(17).Text) - (Val(MDIForm1.Image01.Top - 8000) * 0.02 * 2) + Val(Form1.Text12(1).Text) - Val(Form1.Text12(0).Text) / ZhiJing ElseIf CODE15 = 3 Then xmbz = (Val(Form1.Text13(17).Text) - (Val(MDIForm1.Image01.Top - 8000) * 0.02 * 2) + Val(Form1.Text14(1).Text) - Val(Form1.Text14(0).Text) / ZhiJing ElseIf CODE15 = 4 Then xmbz = (Val(Form1.Text13(17).Text) - (Val(MDIForm1.Image01.Top - 8000) * 0.02 * 2) + Val(Form1.Text15(1).Text) - Val(Form1.Text15(0).Text) / ZhiJing ElseIf CODE15 = 5 Then xmbz = (Val(Form1.Text13(17).Text) - (Val(MDIForm1.Image01.Top - 8000) * 0.02 * 2) + Val(Form1.Text16(1).Text) - Val(Form1.Text16(0).Text) / ZhiJing End If If xmbz = -0.1 Then xmbz = 0 End If End If ?(追加的end if) If Form1.Text13(18).Text = Or Form1.Text13(18).Text = 0 Then zmbz = 0 Else 工件长度=Z机床坐标+Z磨损-Z偏置 If CODE15 = 1 Then zmbz = Val(Form1.Text13(18).Text) - (Val(MDIForm1.Image01.Left - 9000) * 0.02) + Val(Form1.Text11(3).Text) - Val(Form1.Text11(2).Text) 增量z1 ElseIf CODE15 = 2 Then zmbz = Val(Form1.Text13(18).Text) - (Val(MDIForm1.Image01.Left - 9000) * 0.02) + Val(Form1.Text12(3).Text) - Val(Form1.Text12(2).Text) 增量z2 ElseIf CODE15 = 3 Then zmbz = Val(Form1.Text13(18).Text) - (Val(MDIForm1.Image01.Left - 9000) * 0.02) + Val(Form1.Text14(3).Text) - Val(Form1.Text14(2).Text) 增量z3 ElseIf CODE15 = 4 Then zmbz = Val(Form1.Text13(18).Text) - (Val(MDIForm1.Image01.Left - 9000) * 0.02) + Val(Form1.Text15(3).Text) - Val(Form1.Text15(2).Text) 增量z4 ElseIf CODE15 = 5 Then zmbz = Val(Form1.Text13(18).Text) - (Val(MDIForm1.Image01.Left - 9000) * 0.02) + Val(Form1.Text16(3).Text) - Val(Form1.Text16(2).Text) 增量z5 End If If zmbz = -0.1 Then zmbz = 0 End If End If ?(追加的end if)DataX = MDIForm1.UserC11.Top 当前点的坐标DataZ = MDIForm1.UserC11.Left 当前点的坐标JXS = Abs(Val(Form1.Text13(19).Text) IJZS = Abs(Val(Form1.Text13(21).Text) KEnd IfIf (CODE1 = 1 And CODE2 = 0) Or (CODE1 = 0 And CODE2 = 0) Then G91G00或G90G00 If zmbz 0 Then Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoZ = 8 Case 2 ZouDaoZ = 10 Case 3 ZouDaoZ = 15 End Select Timer4.Enabled = True Timer4.Interval = 5 ElseIf zmbz = 0 Then ZouDaoZ = 0 Timer5.Enabled = False Timer4.Enabled = False End If If xmbz 0 Then Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 ZouDaoX = 8 Case 2 ZouDaoX = 10 Case 3 ZouDaoX = 15 End Select Timer2.Enabled = True Timer2.Interval = 5 ElseIf xmbz = 0 Then ZouDaoX = 0 Timer3.Enabled = False Timer2.Enabled = False End IfElseIf (CODE1 = 1 And CODE2 = 1) Or (CODE1 = 0 And CODE2 = 1) ThenG91G01或G90G01pdgs = 0Select Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zdpd = Int(Abs(xmbz) + Abs(zmbz) / 0.04) 总步数 Case 2 zdpd = Int(Abs(xmbz) + Abs(zmbz) / 0.1) 总步数 Case 3 zdpd = Int(Abs(xmbz) + Abs(zmbz) / 0.2) 总步数End Select If (zmbz = 0 And xmbz = 0) Then ZouDaoX = 0 ZouDaoZ = 0 Timer6.Enabled = False Else Timer6.Enabled = True Timer6.Interval = 5 End IfElseIf (CODE1 = 1 And CODE2 = 2) Or (CODE1 = 0 And CODE2 = 2) Then G91G02或G90G02pdgs = 0 JfSelect Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zdpd = Int(Abs(xmbz) + Abs(zmbz) / 0.04) 总步数 Case 2 zdpd = Int(Abs(xmbz) + Abs(zmbz) / 0.1) 总步数 Case 3 zdpd = Int(Abs(xmbz) + Abs(zmbz) / 0.2) 总步数End Select If (zmbz = 0 And xmbz = 0) Then ZouDaoX = 0 ZouDaoZ = 0 Timer7.Enabled = False Else Timer7.Enabled = True Timer7.Interval = 5 End IfElseIf (CODE1 = 1 And CODE2 = 3) Or (CODE1 = 0 And CODE2 = 3) Then G91G03或G90G03pdgs = 0 JfSelect Case jingeibeilv 进给率调整速率50,100,150。 Case 1 zdpd = Int(Abs(xmbz) + Abs(zmbz) / 0.04) 总步数 Case 2 zdpd = Int(Abs(xmbz) + Abs(zmbz) / 0.1) 总步数 Case 3 zdpd = Int(Abs(xmbz) + Abs(zmbz) / 0.2) 总步数End Select If (zmbz = 0 And xmbz = 0) Then Timer8.Enabled = False ZouDaoX = 0 ZouDaoZ = 0 Else Timer8.Enabled = True Timer8.Interval = 5 End IfElseIf (CODE1 = 1 And CODE2 = 4) Or (CODE1 = 0 And CODE2 = 4) ThenG91G33或G90G33pdgs = 0zdpd = Int(Abs(xmbz) + Abs(zmbz) / 0.3) 总步数 If (zmbz = 0 And xmbz = 0) Then ZouDaoX = 0 ZouDaoZ = 0 Timer9.Enabled = False Else Timer9.Enabled = True Timer9.Interval = 5 End IfEnd IfIf CODE3 = 1 Then -G04 Timer1.Enabled = True Timer1.Interval = 100End IfIf CODE5 = 1 Then ZhiJing = 1 Form1.Text13(12).Text = 22ElseIf CODE5 = 0 Then ZhiJing = 2 Form1.Text13(12).Text = 23End IfIf CODE6 = 1 Then -G158 Form1.Text11(0) = Form1.Text11(0) + N158X 16号刀具的新的刀偏值 Form1.Text12(0) = Form1.Text12(0) + N158X Form1.Text14(0) = Form1.Text14(0) + N158X Form1.Text15(0) = Form1.Text15(0) + N158X Form1.Text16(0) = Form1.Text16(0) + N158X Form1.Text17(0) = Form1.Text17(0) + N158X Form1.Text11(2) = Form1.Text11(2) + N158Z Form1.Text12(2) = Form1.Text12(2) + N158Z Form1.Text14(2) = Form1.Text14(2) + N158Z Form1.Text15(2) = Form1.Text15(2) + N158Z Form1.Text16(2) = Form1.Text16(2) + N158Z Form1.Text17(2) = Form1.Text17(2) + N158Z CODE6 = 0 N158X = 0 N158Z = 0 If fangshi = 0 Then Timer10.Enabled = True ElseIf fangshi = 1 Or fangshi = 2 Then Timer10.Enabled = False End IfEnd IfIf CODE7 = 1 Then Form1.Label8.Caption = F:mm/min ElseIf CODE7 = 0 Then Form1.Label8.Caption = F:mm/radEnd IfIf CODE8 = 1 Then -G96/G97 Form2.Timer11.Enabled = True Form2.Timer11.Interval = 5 Else: Form2.Timer11.Enabled = False G96CanShu = 1 Form2.Timer11.Interval = 0End IfIf CODE13 = 2 Then M04 MDIForm1.Timer2.Enabled = True Form1.Timer1.Enabled = True Form1.Timer3.Enabled = True ElseIf CODE13 = 1 Then M03 MDIForm1.Timer1.Enabled = True Form1.Timer1.Enabled = True Form1.Timer3.Enabled = True ElseIf CODE13 = 0 Then M05 jingeilvbh = False 用于自动运行方式下调节倍率判断(没有运行时) MDIForm1.Timer1.Enabled = False 主轴正转停 MDIForm1.Timer2.Enabled = False 主轴反转停 Form1.Timer1.Enabled = False Form1.Timer3.Enabled = False Form1.Text3.Text = 0 MDIForm1.Timer11.Enabled = False 水龙头有、流水开-流水停 MDIForm1.UserC1.Visible = False MDIForm1.UserC2.Visible = False MDIForm1.UserC4.Visible = False MDIForm1.UserC3.Visible = False MDIForm1.UserC5.Visible = False MDIForm1.UserC6.Visible = False Picture9.BackColor = &HFF& 红End IfIf CODE10 = 1 Then M00&M01Timer10.Enabled = False If Timer2.Enabled = True Then Timer2.Enabled = False duandianbz = 1 End If If Timer3.Enabled = True Then Timer3.Enabled = False duandianbz = 2 End If If Timer4.Enabled = True Then Timer4.Enabled = False duandianbz = 3 End If If Timer5.Enabled = True Then Timer5.Enabled = False duandianbz = 4 End If If Timer6.Enabled = True Then Timer6.Enabled = False duandianbz = 5 End If If Timer7.Enabled = True Then Timer7.Enabled = False duandianbz = 6 End If If Timer8.Enabled = True Then Timer8.Enabled = False duandianbz = 7 End If If Timer9.Enabled = True Then Timer9.Enabled = False duandianbz = 8 End IfEnd IfIf CODE9 = 1 Then MDIForm1.UserC0.Visible = True 水龙头流水开 Picture9.BackColor = &H80FF80 绿(工作) MDIForm1.Timer11.Enabled = TrueEnd IfIf CODE9 = 2 Then MDIForm1.Timer11.Enabled = False 水龙头有、流水开-流水停 MDIForm1.UserC1.Visible = False MDIForm1.UserC2.Visible = False MDIForm1.UserC4.Visible = False MDIForm1.UserC3.Visible = False MDIForm1.UserC5.Visible = False MDIForm1.UserC6.Visible = False Picture9.BackColor = &HFF& 红End IfEnd Sub %如何从一个字符串中读取一行字符?Function ReadStringLine(src_str As String, lineno As Integer) As StringOn Error Resume NextDim string_flag As IntegerDim line_cnt As IntegerDim test_string As StringDim ret_string As Stringline_cnt = 0 初始- 行数为1string_flag = 1 标志为1test_string = Right(src_str, 2)If test_string vbCrLf Thentest_string = src_str + vbCrLfElsetest_string = src_strEnd IfDoEventsDoline_cnt = line_cnt + 1string_flag = InStr(test_string, vbCrLf)ret_string = Left(test_string, string_flag)test_string = Right(test_string, Len(test_string) - string_flag - 1)Loop Until lineno = line_cntIf line_cnt = 1 Then ReadStringLine = ret_stringElseReadStringLine = Left(ret_string, Len(ret_string) - 1)End IfEnd FunctionPrivate Sub DaoJiaShuiDi() 刀架,水滴移动函数+Z,-Z,+X,-X(插补)MDIForm1.Image01.Move MDIForm1.Image01.Left + ZouDaoZ, MDIForm1.Image01.Top + ZouDaoXMDIForm1.UserC0.Move MDIForm1.UserC0.Left + ZouDaoZ, MDIForm1.UserC0.TopMDIForm1.UserC1.Move MDIForm1.UserC1.Left + ZouDaoZ, MDIForm1.UserC1.TopMDIForm1.UserC2.Move MDIForm1.UserC2.Left + ZouDaoZ, MDIForm1.UserC2.TopMDIForm1.UserC3.Move MDIForm1.UserC3.Left + ZouDaoZ, MDIForm1.UserC3.TopMDIForm1.UserC4.Move MDIForm1.UserC4.Left + ZouDaoZ, MDIForm1.UserC4.TopMDIForm1.UserC5.Move MDIForm1.UserC5.Left + ZouDaoZ, MDIForm1.UserC5.TopMDIForm1.UserC6.Move MDIForm1.UserC6.Left + ZouDaoZ, MDIForm1.UserC6.TopEnd SubPrivate Sub DaoJiaShuiDi01() 刀架,水滴移动函数+Z,-Z(快速定位)MDIForm1.Image01.Move MDIForm1.Image01.Left + ZouDaoZ, MDIForm1.Image01.TopMDIForm1.UserC0.Move MDIForm1.UserC0.Left + ZouDaoZ, MDIForm1.UserC0.TopMDIForm1.UserC1.Move MDIForm1.UserC1.Left + ZouDaoZ, MDIForm1.UserC1.TopMDIForm1.UserC2.Move MDIForm1.UserC2.Left + ZouDaoZ, MDIForm1.UserC2.TopMDIForm1.UserC3.Move MDIForm1.UserC3.Left + ZouDaoZ, MDIForm1.UserC3.TopMDIForm1.UserC4.Move MDIForm1.UserC4.Left + ZouDaoZ, MDIForm1.UserC4.TopMDIForm1.UserC5.Move MDIForm1.UserC5.Left + ZouDaoZ, MDIForm1.UserC5.TopMDIForm1.UserC6.Move MDIForm1.UserC6.Left + ZouDaoZ, MDIForm1.UserC6.TopEnd SubPrivate Sub PianDao1() 90偏刀(粗) MDIForm1.Picture4.Line (MDIForm1.UserC11.Left, MDIForm1.UserC11.Top)-Step(0, 500), RGB(128, 255, 128) 工作刀具 MDIForm1.Picture4.Line (MDIForm1.UserC11.Left, MDIForm1.UserC11.Top + 500)-Step(70, 0), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC11.Left + 60, MDIForm1.UserC11.Top + 500)-Step(0, 620), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC11.Left, MDIForm1.UserC11.Top - 20)-Step(350, 80), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC11.Left + 350, MDIForm1.UserC11.Top + 80)-Step(130, 310), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC11.Left + 480, MDIForm1.UserC11.Top + 380)-Step(0, 740), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC11.Left + 60, MDIForm1.UserC11.Top + 1120)-Step(420, 0), RGB(128, 255, 128)End SubPrivate Sub PianDao2() 90偏刀(粗)隐形刀具 MDIForm1.Picture4.Line (MDIForm1.UserC21.Left + 70, MDIForm1.UserC21.Top)-Step(0, 625), RGB(128, 255, 128) 隐形刀具 MDIForm1.Picture4.Line (MDIForm1.UserC21.Left + 70, MDIForm1.UserC21.Top + 625)-Step(-70, 0), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC21.Left, MDIForm1.UserC21.Top + 625)-Step(0, 480), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC21.Left, MDIForm1.UserC21.Top + 1150)-Step(350, -80), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC21.Left + 360, MDIForm1.UserC21.Top + 1095 - 70)-Step(130, -300), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC21.Left + 480, MDIForm1.UserC21.Top + 1095 - 370)-Step(0, -715), RGB(128, 255, 128) MDIForm1.Picture4.Line (MDIForm1.UserC21.Left, MDIForm1.UserC21.Top)-Step(470, 0), RGB(128, 255, 128)End SubPrivate Sub LuoWenDao1() 螺纹刀MDIForm1.Picture4.Line (MDIForm1.UserC31.Left + 100, MDIForm1.UserC31.Top - 10)-Step(-130, 250), RGB(128, 255, 128) 工作刀具MDIForm1.Picture4.Line (MDIForm1.UserC31.Left - 10, MDIForm1.UserC31.Top + 240)-Step(0, 930), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC31.Left + 120, MDIForm1.UserC31.Top - 10)-Step(120, 250), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC31.Left + 240, MDIForm1.UserC31.Top + 240)-Step(0, 930), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC31.Left, MDIForm1.UserC31.Top + 1160)-Step(240, 0), RGB(128, 255, 128)End SubPrivate Sub LuoWenDao2() 螺纹刀隐形刀具MDIForm1.Picture4.Line (MDIForm1.UserC41.Left, MDIForm1.UserC41.Top)-Step(0, 930), RGB(128, 255, 128) 隐形刀具MDIForm1.Picture4.Line (MDIForm1.UserC41.Left, MDIForm1.UserC41.Top + 930)-Step(125, 240), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC41.Left + 110, MDIForm1.UserC41.Top + 1170)-Step(110, -240), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC41.Left + 260, MDIForm1.UserC41.Top + 930)-Step(0, -930), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC41.Left, MDIForm1.UserC41.Top)-Step(240, 0), RGB(128, 255, 128)End SubPrivate Sub JingCheDao1() 精车刀MDIForm1.Picture4.Line (MDIForm1.UserC51.Left, MDIForm1.UserC51.Top)-Step(0, 550), RGB(128, 255, 128) 工作刀具MDIForm1.Picture4.Line (MDIForm1.UserC51.Left, MDIForm1.UserC51.Top + 550)-Step(80, 0), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC51.Left + 80, MDIForm1.UserC51.Top + 550)-Step(0, 610), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC51.Left, MDIForm1.UserC51.Top)-Step(360, 240), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC51.Left + 360, MDIForm1.UserC51.Top + 240)-Step(120, 360), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC51.Left + 480, MDIForm1.UserC51.Top + 600)-Step(0, 560), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC51.Left, MDIForm1.UserC51.Top + 1150)-Step(480, 0), RGB(128, 255, 128)End SubPrivate Sub JingCheDao2() 精车刀隐形刀具MDIForm1.Picture4.Line (MDIForm1.UserC61.Left + 80, MDIForm1.UserC61.Top)-Step(0, 610), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC61.Left + 80, MDIForm1.UserC61.Top + 590)-Step(-80, 0), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC61.Left, MDIForm1.UserC61.Top + 610)-Step(0, 550), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC61.Left, MDIForm1.UserC61.Top + 1160)-Step(360, -240), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC61.Left + 360, MDIForm1.UserC61.Top + 920)-Step(120, -360), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC61.Left + 490, MDIForm1.UserC61.Top + 560)-Step(0, -550), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC61.Left, MDIForm1.UserC61.Top)-Step(480, 0), RGB(128, 255, 128)End SubPrivate Sub QieCaoDao1() 切槽刀MDIForm1.Picture4.Line (MDIForm1.UserC71.Left, MDIForm1.UserC71.Top)-Step(0, 1160), RGB(128, 255, 128) 工作刀具MDIForm1.Picture4.Line (MDIForm1.UserC71.Left, MDIForm1.UserC71.Top)-Step(240, 0), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC71.Left + 240, MDIForm1.UserC71.Top)-Step(0, 1160), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC71.Left, MDIForm1.UserC71.Top + 1160)-Step(240, 0), RGB(128, 255, 128)End SubPrivate Sub QieCaoDao2() 切槽刀隐形刀具MDIForm1.Picture4.Line (MDIForm1.UserC81.Left, MDIForm1.UserC81.Top)-Step(0, 1155), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC81.Left, MDIForm1.UserC81.Top + 1150)-Step(240, 0), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC81.Left + 240, MDIForm1.UserC81.Top)-Step(0, 1155), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC81.Left, MDIForm1.UserC81.Top)-Step(240, 0), RGB(128, 255, 128)End SubPrivate Sub TangDao1() 镗刀MDIForm1.Picture4.Line (MDIForm1.UserC91.Left - 5, MDIForm1.UserC91.Top + 450)-Step(50, -230), RGB(128, 255, 128) 工作刀具MDIForm1.Picture4.Line (MDIForm1.UserC91.Left + 50, MDIForm1.UserC91.Top + 225)-Step(310, -230), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC91.Left + 360, MDIForm1.UserC91.Top)-Step(870, 0), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC91.Left - 5, MDIForm1.UserC91.Top + 465)-Step(420, 0), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC91.Left + 420, MDIForm1.UserC91.Top + 460)-Step(0, -160), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC91.Left + 420, MDIForm1.UserC91.Top + 290)-Step(810, 0), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC91.Left + 1220, MDIForm1.UserC91.Top)-Step(0, 280), RGB(128, 255, 128)End SubPrivate Sub TangDao2() 镗刀隐形刀具MDIForm1.Picture4.Line (MDIForm1.UserC101.Left, MDIForm1.UserC101.Top)-Step(420, 0), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC101.Left + 420, MDIForm1.UserC101.Top)-Step(0, 160), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC101.Left + 420, MDIForm1.UserC101.Top + 160)-Step(810, 0), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC101.Left + 1220, MDIForm1.UserC101.Top + 160)-Step(0, 280), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC101.Left, MDIForm1.UserC101.Top)-Step(50, 230), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC101.Left + 50, MDIForm1.UserC101.Top + 235)-Step(310, 230), RGB(128, 255, 128)MDIForm1.Picture4.Line (MDIForm1.UserC101.Left + 350, MDIForm1.UserC101.Top + 460)-Step(870, 0), RGB(128, 255, 128)End SubForm4:Private Sub Command1_Click()Form4.Visible = FalseEnd SubPrivate Sub Command2_Click()Form4.Enabled = FalseForm4.Visible = FalseEnd SubPrivate Sub Option1_Click(Index As Integer) 刀位表Static daojvi As IntegerIf Option2(0).Value = True Then If Option1(Index).Value = True Then If Index = 0 Then Text1(0).Text = 90粗车刀 Picture1(0).Visible = False Picture1(1).Visible = True For daojvi = 2 To 5 Picture1(daojvi).Visible = False Next daojvi ElseIf Index = 1 Then Text1(0).Text = 三角螺纹刀 Picture1(0).Visible = False Picture1(1).Visible = False Picture1(2).Visible = True For daojvi = 3 To 5 Picture1(daojvi).Visible = False Next daojvi ElseIf Index = 2 Then Text1(0).Text = 90精车刀 For daojvi = 0 To 2 Picture1(daojvi).Visible = False Next daojvi Picture1(3).Visible = True Picture1(4).Visible = False Picture1(5).Visible = False ElseIf Index = 3 Then Text1(0).Text = 外圆切槽刀 For daojvi = 0 To 3 Picture1(daojvi).Visible = False Next daojvi Picture1(4).Visible = True Picture1(5).Visible = False ElseIf Index = 4 Then Text1(0).Text = 内孔镗刀 For daojvi = 0 To 4 Picture1(daojvi).Visible = False Next daojvi Picture1(5).Visible = True Else: Text1(0).Text = 内孔切槽刀 Picture1(0).Visible = True End If End IfEnd IfIf Option2(1).Value = True Then If Option1(Index).Value = True Then If Index = 0 Then Text1(1).Text = 90粗车刀 Picture1(0).Visible = False Picture1(1).Visible = True For daojvi = 2 To 5 Picture1(daojvi).Visible = False Next daojvi ElseIf Index = 1 Then Text1(1).Text = 三角螺纹刀 Picture1(0).Visible = False Picture1(1).Visible = False Picture1(2).Visible = True For daojvi = 3 To 5 Picture1(daojvi).Visible = False Next daojvi ElseIf Index = 2 Then Text1(1).Text = 90精车刀 For daojvi = 0 To 2 Picture1(daojvi).Visible = False Next daojvi Picture1(3).Visible = True Picture1(4).Visible = False Picture1(5).Visible = False ElseIf Index = 3 Then Text1(1).Text = 外圆切槽刀 For daojvi = 0 To 3 Picture1(daojvi).Visible = False Next daojvi Picture1(4).Visible = True Picture1(5).Visible = False ElseIf Index = 4 Then Text1(1).Text = 内孔镗刀 For daojvi = 0 To 4 Picture1(da
- 温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

人人文库网所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
2:不支持迅雷下载,请使用浏览器下载
3:不支持QQ浏览器下载,请用其他浏览器
4:下载后的文档和图纸-无水印
5:文档经过压缩,下载后原文更清晰
|