ed0ac05479
- Miglioramenti comunicazione CN Flexium. - Aggiunti comandi MDI attraverso LUA in pagina tagli diretti.
119 lines
4.4 KiB
VB.net
119 lines
4.4 KiB
VB.net
Imports EgtUILib
|
|
|
|
Public Class DirectCutPageUC
|
|
|
|
' Dichiarazione delle Page UserControl
|
|
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
|
Friend m_MachineButtons As MachineButtonsUC
|
|
Friend m_CN As CN_generico
|
|
Private m_bFirst As Boolean = True
|
|
|
|
Private Sub DirectCutPage_Initialized(sender As Object, e As EventArgs)
|
|
|
|
'Creazione delle Page UserControl
|
|
m_MachineButtons = New MachineButtonsUC
|
|
|
|
'Posizionemento nella griglia delle Page UserControl
|
|
m_MachineButtons.SetValue(Grid.RowProperty, 2)
|
|
m_MachineButtons.SetValue(Grid.RowProperty, 2)
|
|
|
|
'Assegno SceneButtons alla pagina
|
|
LowerButtonGrid.Children.Add(m_MachineButtons)
|
|
|
|
FeedTxBl.Text = "F"
|
|
SpeedTxBl.Text = "S"
|
|
|
|
Dim AxesName As String = String.Empty
|
|
GetPrivateProfileString(S_AXES, K_L1NAME, "", AxesName, m_MainWindow.GetMachIniFile())
|
|
L1Btn.Content = AxesName
|
|
GetPrivateProfileString(S_AXES, K_L2NAME, "", AxesName, m_MainWindow.GetMachIniFile())
|
|
L2Btn.Content = AxesName
|
|
GetPrivateProfileString(S_AXES, K_L3NAME, "", AxesName, m_MainWindow.GetMachIniFile())
|
|
L3Btn.Content = AxesName
|
|
GetPrivateProfileString(S_AXES, K_R1NAME, "", AxesName, m_MainWindow.GetMachIniFile())
|
|
R1Btn.Content = AxesName
|
|
GetPrivateProfileString(S_AXES, K_R2NAME, "", AxesName, m_MainWindow.GetMachIniFile())
|
|
R2Btn.Content = AxesName
|
|
|
|
End Sub
|
|
|
|
Private Sub DirectCutPage_Loaded(sender As Object, e As RoutedEventArgs)
|
|
'If m_bFirst Then
|
|
' m_bFirst = False
|
|
'End If
|
|
Dim dTemp As Double
|
|
EgtTdbSetCurrTool(m_MainWindow.m_CurrentProjectPageUC.ToolTxBx.Text)
|
|
EgtTdbGetCurrToolParam(MCH_TP.SPEED, dTemp)
|
|
SpeedTxBx.Text = dTemp
|
|
EgtTdbGetCurrToolParam(MCH_TP.FEED, dTemp)
|
|
FeedTxBx.Text = dTemp
|
|
End Sub
|
|
|
|
|
|
Private Sub L1Btn_Click(sender As Object, e As RoutedEventArgs) Handles L1Btn.Click, L2Btn.Click, L3Btn.Click, R1Btn.Click, R2Btn.Click
|
|
Dim CurrentBtn As Button = e.Source
|
|
Dim dTemp As Double = 0
|
|
Dim CmdString As String = String.Empty
|
|
EgtLuaExecFile(m_MainWindow.GetMachinesRootDir() & "\" & m_MainWindow.GetCurrMachine() & "\DirectCmd\AxesMove.lua")
|
|
StringToDouble(FeedTxBx.Text, dTemp)
|
|
EgtLuaSetGlobNumVar("CMD.F", dTemp)
|
|
StringToDouble(SpeedTxBx.Text, dTemp)
|
|
EgtLuaSetGlobNumVar("CMD.S", dTemp)
|
|
EgtLuaSetGlobStringVar("CMD.AXISNAME", GetAxisName(CurrentBtn))
|
|
StringToDouble(GetAxisMove(CurrentBtn), dTemp)
|
|
EgtLuaSetGlobStringVar("CMD.AXISMOVE", dTemp)
|
|
EgtLuaExecLine("CmdString()")
|
|
EgtLuaGetGlobStringVar("CMD.CMDSTRING", CmdString)
|
|
EgtLuaResetGlobVar("CmdString")
|
|
EgtLuaResetGlobVar("CMD")
|
|
|
|
m_CN.DGeneralFunctions_WriteCncMode(2)
|
|
m_CN.sz_ManualDataInput = CmdString
|
|
m_CN.MDI_command()
|
|
m_CN.DGeneralFunctions_CycleStart()
|
|
m_CN.DGeneralFunctions_WriteCncMode(7)
|
|
|
|
End Sub
|
|
|
|
Private Function GetAxisName(ByVal nBtnName As Button) As String
|
|
Dim AxesName As String = String.Empty
|
|
Select Case nBtnName.Name
|
|
Case L1Btn.Name
|
|
GetPrivateProfileString(S_AXES, K_L1NAME, "", AxesName, m_MainWindow.GetMachIniFile())
|
|
Return AxesName
|
|
Case L2Btn.Name
|
|
GetPrivateProfileString(S_AXES, K_L2NAME, "", AxesName, m_MainWindow.GetMachIniFile())
|
|
Return AxesName
|
|
Case L3Btn.Name
|
|
GetPrivateProfileString(S_AXES, K_L3NAME, "", AxesName, m_MainWindow.GetMachIniFile())
|
|
Return AxesName
|
|
Case R1Btn.Name
|
|
GetPrivateProfileString(S_AXES, K_R1NAME, "", AxesName, m_MainWindow.GetMachIniFile())
|
|
Return AxesName
|
|
Case R2Btn.Name
|
|
GetPrivateProfileString(S_AXES, K_R2NAME, "", AxesName, m_MainWindow.GetMachIniFile())
|
|
Return AxesName
|
|
End Select
|
|
Return String.Empty
|
|
End Function
|
|
|
|
Private Function GetAxisMove(ByVal nBtnName As Button) As String
|
|
Dim AxesMove As Double = 0
|
|
Select Case nBtnName.Name
|
|
Case L1Btn.Name
|
|
Return L1TxBx.Text
|
|
Case L2Btn.Name
|
|
Return L2TxBx.Text
|
|
Case L3Btn.Name
|
|
Return L3TxBx.Text
|
|
Case R1Btn.Name
|
|
Return R1TxBx.Text
|
|
Case R2Btn.Name
|
|
Return R2TxBx.Text
|
|
End Select
|
|
Return String.Empty
|
|
End Function
|
|
|
|
|
|
End Class
|