📄 main.frm
字号:
Height = 372
Left = 240
TabIndex = 0
Top = 120
Width = 1932
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "硬件触发变化直接调用GetGChange函数"
Height = 180
Left = 360
TabIndex = 47
Top = 7320
Width = 3060
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "设定变化时差 毫秒"
Height = 180
Left = 5160
TabIndex = 46
Top = 7440
Width = 1530
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "显示端显示G代码情况"
Height = 180
Left = 6480
TabIndex = 42
Top = 5040
Width = 1710
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "选择对应G代码文件"
Height = 180
Left = 7200
TabIndex = 41
Top = 120
Width = 1530
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "G代码"
Height = 180
Left = 6600
TabIndex = 40
Top = 120
Width = 450
End
Begin VB.Label lblRPM
Caption = "0"
BeginProperty Font
Name = "MS Sans Serif"
Size = 24
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1680
TabIndex = 34
Top = 6000
Width = 3255
End
Begin VB.Label Label2
Caption = "RPM"
BeginProperty Font
Name = "MS Sans Serif"
Size = 24
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Index = 4
Left = 240
TabIndex = 33
Top = 6000
Width = 1215
End
Begin VB.Label ACoord
Caption = "0"
BeginProperty Font
Name = "MS Sans Serif"
Size = 24
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 720
TabIndex = 28
Top = 5400
Width = 4215
End
Begin VB.Label Label2
Caption = "A"
BeginProperty Font
Name = "MS Sans Serif"
Size = 24
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Index = 3
Left = 240
TabIndex = 27
Top = 5400
Width = 375
End
Begin VB.Label sbrBar
Height = 255
Left = 0
TabIndex = 23
Top = 6840
Width = 6255
End
Begin VB.Label Label5
Caption = "Start Vel Max SPS Accel AccelScale"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2400
TabIndex = 21
Top = 1080
Width = 3975
End
Begin VB.Label Label4
Caption = "Com Port"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2400
TabIndex = 15
Top = 240
Width = 975
End
Begin VB.Label ZCoord
Caption = "0"
BeginProperty Font
Name = "MS Sans Serif"
Size = 24
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 720
TabIndex = 14
Top = 4800
Width = 4215
End
Begin VB.Label YCoord
Caption = "0"
BeginProperty Font
Name = "MS Sans Serif"
Size = 24
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 720
TabIndex = 13
Top = 4200
Width = 4215
End
Begin VB.Label XCoord
Caption = "0"
BeginProperty Font
Name = "MS Sans Serif"
Size = 24
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 720
TabIndex = 12
Top = 3600
Width = 4215
End
Begin VB.Label Label2
Caption = "Z"
BeginProperty Font
Name = "MS Sans Serif"
Size = 24
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 612
Index = 2
Left = 240
TabIndex = 11
Top = 4800
Width = 372
End
Begin VB.Label Label2
Caption = "Y"
BeginProperty Font
Name = "MS Sans Serif"
Size = 24
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 612
Index = 1
Left = 240
TabIndex = 10
Top = 4200
Width = 372
End
Begin VB.Label Label2
Caption = "X"
BeginProperty Font
Name = "MS Sans Serif"
Size = 24
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 612
Index = 0
Left = 240
TabIndex = 9
Top = 3600
Width = 372
End
Begin VB.Label Label1
Caption = "Jog Distance in Steps"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 240
TabIndex = 2
Top = 1560
Width = 2172
End
End
Attribute VB_Name = "Main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Jogging As Boolean
Dim Chase As Boolean
Dim CurX, CurY, CurZ, CurA As Long
Dim RPMON As Boolean
Dim OverRide As Long
Dim sOldX As String
Dim sOldY As String
Dim sOldZ As String
Dim sOldA As String
Dim intIn As Integer
Private Sub btnDown_Click()
Dim NewPos, X, Y, Z, A As Long
Dim Ack As Byte
Dim com As TDeskWinAPICommand
If Jogging Then Exit Sub
Jogging = True
UpdatePositionFromController
NewPos = Val(txtDist.Text)
com.X = CurX
com.Y = CurY
com.Z = CurZ - NewPos
com.A = CurA
com.EndSPS = 0
com.SlewSPS = Val(txtMaxSPS.Text)
com.CommandType = RAPIDFEED
Ack = SendAPICommandToController(com)
GetStatusUntilInPosition
Jogging = False
End Sub
Private Sub btnFeedMinus_Click()
Dim com As TDeskWinAPICommand
Dim Ack As Long
If Mode2ndGen Then
OverRide = OverRide + 10
Else
OverRide = OverRide - 10
End If
btnFeedPlus.Caption = "Feed (" + str(OverRide) + ")"
com.CommandType = SETOVERRIDE
com.SlewSPS = OverRide
Ack = SendAPICommandToController(com)
End Sub
Private Sub btnFeedPlus_Click()
Dim com As TDeskWinAPICommand
Dim Ack As Long
If Mode2ndGen Then
OverRide = OverRide - 10
Else
OverRide = OverRide + 10
End If
btnFeedPlus.Caption = "Feed (" + str(OverRide) + ")"
com.CommandType = SETOVERRIDE
com.SlewSPS = OverRide
Ack = SendAPICommandToController(com)
End Sub
Private Sub btnInit_Click()
Dim com As TDeskWinAPICommand
Dim Ack As Long
Dim init As Integer
Port = Val(txtPort.Text)
com.CommandType = RESETCONTROL
If chkMode.Value = 1 Then
Mode2ndGen = True
Else
Mode2ndGen = False
End If
Ack = SendAPICommandToController(com)
sbrBar.Caption = "Ack = " + str(Ack)
FirmVer = DeskWinGetFirmwareVersion
If FirmVer <> 0 Then
sbrBar.Caption = "Firmware Version " + str(FirmVer) + " detected..."
Else
sbrBar.Caption = "Controller NOT detected..."
End If
com.CommandType = SETOVERRIDEMAX
If Mode2ndGen Then
com.SlewSPS = 100000 'max SPS
com.NumSteps = 8000
Else
com.SlewSPS = 40000
com.NumSteps = 0
End If
'' execute Aux Output Imediately - do not buffer (com.axis = 0 to buffer output)
com.Axis = 1
Ack = SendAPICommandToController(com)
init = rs274ngc_ext_init(App.Path & "\DeskCNC.Ini")
End Sub
Private Sub btnNegA_Click()
Dim NewPos, X, Y, Z, A As Long
Dim Ack As Byte
Dim com As TDeskWinAPICommand
If Jogging Then Exit Sub
Jogging = True
UpdatePositionFromController
NewPos = Val(txtDist.Text)
com.X = CurX
com.Y = CurY
com.Z = CurZ
com.A = CurA - NewPos
com.EndSPS = 0
com.SlewSPS = Val(txtMaxSPS.Text)
com.CommandType = RAPIDFEED
Ack = SendAPICommandToController(com)
GetStatusUntilInPosition
Jogging = False
End Sub
Private Sub btnNegX_Click()
Dim NewPos, X, Y, Z, A As Long
Dim Ack As Byte
Dim com As TDeskWinAPICommand
If Jogging Then Exit Sub
Jogging = True
UpdatePositionFromController
NewPos = Val(txtDist.Text)
com.X = CurX - NewPos
com.Y = CurY
com.Z = CurZ
com.A = CurA
com.EndSPS = 0
com.SlewSPS = Val(txtMaxSPS.Text)
com.CommandType = RAPIDFEED
Ack = SendAPICommandToController(com)
GetStatusUntilInPosition
Jogging = False
End Sub
Private Sub btnNegY_Click()
Dim NewPos, X, Y, Z, A As Long
Dim Ack As Byte
Dim com As TDeskWinAPICommand
If Jogging Then Exit Sub
Jogging = True
UpdatePositionFromController
NewPos = Val(txtDist.Text)
com.X = CurX
com.Y = CurY - NewPos
com.Z = CurZ
com.A = CurA
com.EndSPS = 0
com.SlewSPS = Val(txtMaxSPS.Text)
com.CommandType = RAPIDFEED
Ack = SendAPICommandToController(com)
GetStatusUntilInPosition
Jogging = False
End Sub
Private Sub btnOutputs_Click()
Dim com As TDeskWinAPICommand
Dim Ack As Byte
If Mode2ndGen Then
com.CommandType = OUTPUTIMEDIATE
com.Dir = 127 '0-127
Ack = SendAPICommandToController(com)
End If
sbrBar.Caption = str(Ack)
End Sub
Private Sub btnPosA_Click()
Dim NewPos, X, Y, Z, A As Long
Dim Ack As Byte
Dim com As TDeskWinAPICommand
If Jogging Then Exit Sub
Jogging = True
UpdatePositionFromController
NewPos = Val(txtDist.Text)
com.X = CurX
com.Y = CurY
com.Z = CurZ
com.A = CurA + NewPos
com.EndSPS = 0
com.SlewSPS = Val(txtMaxSPS.Text)
com.CommandType = RAPIDFEED
Ack = SendAPICommandToController(com)
GetStatusUntilInPosition
Jogging = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -