e2daebcb5a
- aggiornamenti e migliorie varie.
136 lines
5.7 KiB
VB.net
136 lines
5.7 KiB
VB.net
Imports EgtUILib
|
|
|
|
Public Class ManualAxesMoveUC
|
|
|
|
' Dichiarazione delle Page UserControl
|
|
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
|
Friend m_CN As CN_generico
|
|
|
|
Private Sub ManualAxesMove_Initialized(sender As Object, e As EventArgs)
|
|
|
|
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 ManualAxesMove_Loaded(sender As Object, e As RoutedEventArgs)
|
|
Dim nTemp As Integer = 0
|
|
Dim dTemp As Double = 0
|
|
' Leggo feed e speed da lama corrente
|
|
EgtTdbSetCurrTool(m_MainWindow.m_CurrentProjectPageUC.ToolTxBx.Text)
|
|
EgtTdbGetCurrToolParam(MCH_TP.FEED, dTemp)
|
|
FeedTxBx.Text = dTemp
|
|
EgtTdbGetCurrToolParam(MCH_TP.SPEED, dTemp)
|
|
SpeedTxBx.Text = dTemp
|
|
' Agli assi lineari assegno '0' (sono incrementali)
|
|
L1TxBx.Text = "0"
|
|
L2TxBx.Text = "0"
|
|
L3TxBx.Text = "0"
|
|
' Agli assi rotanti assegno i valori macchina
|
|
nTemp = GetPrivateProfileInt(S_AXES, K_R1ID, 8, m_MainWindow.GetMachIniFile())
|
|
R1TxBx.Text = DoubleToString(m_CN.d_axis_position(nTemp), 3)
|
|
nTemp = GetPrivateProfileInt(S_AXES, K_R2ID, 7, m_MainWindow.GetMachIniFile())
|
|
R2TxBx.Text = DoubleToString(m_CN.d_axis_position(nTemp), 3)
|
|
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 nTemp As Integer = 0
|
|
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)
|
|
' Leggo gli assi lineari rispetto allo 0 pezzo (per essere compatibile con G150)
|
|
m_CN.set_OP_OM(1)
|
|
System.Threading.Thread.Sleep(500)
|
|
nTemp = GetPrivateProfileInt(S_AXES, K_L1ID, 0, m_MainWindow.GetMachIniFile())
|
|
dTemp = m_CN.d_axis_position(nTemp)
|
|
EgtLuaSetGlobNumVar("CMD.L1", dTemp)
|
|
nTemp = GetPrivateProfileInt(S_AXES, K_L2ID, 1, m_MainWindow.GetMachIniFile())
|
|
dTemp = m_CN.d_axis_position(nTemp)
|
|
EgtLuaSetGlobNumVar("CMD.L2", dTemp)
|
|
nTemp = GetPrivateProfileInt(S_AXES, K_L3ID, 2, m_MainWindow.GetMachIniFile())
|
|
dTemp = m_CN.d_axis_position(nTemp)
|
|
EgtLuaSetGlobNumVar("CMD.L3", dTemp)
|
|
' Ritorno a leggere dallo 0 macchina
|
|
m_CN.set_OP_OM(0)
|
|
nTemp = GetPrivateProfileInt(S_AXES, K_R1ID, 8, m_MainWindow.GetMachIniFile())
|
|
dTemp = m_CN.d_axis_position(nTemp)
|
|
EgtLuaSetGlobNumVar("CMD.R1", dTemp)
|
|
nTemp = GetPrivateProfileInt(S_AXES, K_R2ID, 7, m_MainWindow.GetMachIniFile())
|
|
dTemp = m_CN.d_axis_position(nTemp)
|
|
EgtLuaSetGlobNumVar("CMD.R2", 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) ' Modalità MDI
|
|
System.Threading.Thread.Sleep(150)
|
|
m_CN.sz_ManualDataInput = CmdString
|
|
m_CN.MDI_command()
|
|
System.Threading.Thread.Sleep(150)
|
|
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
|