d9063fdd0d
- Aggiunti file di log in modulo per comunicazione siemens.
172 lines
8.0 KiB
VB.net
172 lines
8.0 KiB
VB.net
Imports EgtUILib
|
|
|
|
Public Class MachineStatusUC
|
|
|
|
' Riferimento alla MainWindow
|
|
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
|
Private m_MachinePage As MachinePageUC
|
|
' Flag che indica se è stato premuto questo controllo per chiamare la pagina con lista errori
|
|
Friend m_bIsClicked As Boolean = False
|
|
' Oggetto per comunicare con il CN
|
|
Friend m_CN As CN_generico
|
|
' Flag per tipo visualizzazione assi
|
|
Private m_bShowTipAxes As Boolean = False
|
|
|
|
Private Sub MachineStatus_Initialized(sender As Object, e As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Private Sub MachineStatus_Loaded(sender As Object, e As RoutedEventArgs)
|
|
m_MachinePage = m_MainWindow.m_MachinePageUC
|
|
m_bShowTipAxes = GetPrivateProfileInt(S_GENERAL, K_SHOWTIPAXES, 0, m_MainWindow.GetIniFile()) <> 0
|
|
End Sub
|
|
|
|
Private Sub MachineStatus_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs) Handles Me.PreviewMouseDown
|
|
MachinePageClick()
|
|
End Sub
|
|
|
|
Sub MachinePageClick()
|
|
' Emulo il click della pagina Macchina
|
|
Select Case m_MainWindow.m_ActivePage
|
|
Case MainWindow.Pages.WorkInProgress
|
|
m_MainWindow.WorkInProgressBtn.IsChecked = False
|
|
m_MainWindow.MachineBtn.IsChecked = True
|
|
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_WorkInProgressPageUC)
|
|
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_MachinePageUC)
|
|
m_MainWindow.m_ActivePage = MainWindow.Pages.Machine
|
|
m_bIsClicked = True
|
|
Case MainWindow.Pages.DirectCut
|
|
m_MainWindow.DirectCutBtn.IsChecked = False
|
|
m_MainWindow.MachineBtn.IsChecked = True
|
|
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(m_MainWindow.m_DirectCutPageUC)
|
|
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_CurrentProjectPageUC)
|
|
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_MachinePageUC)
|
|
m_MainWindow.m_ActivePage = MainWindow.Pages.Machine
|
|
m_bIsClicked = True
|
|
Case MainWindow.Pages.CadCut
|
|
m_MainWindow.CadCutBtn.IsChecked = False
|
|
m_MainWindow.MachineBtn.IsChecked = True
|
|
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(m_MainWindow.m_CadCutPageUC)
|
|
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_CurrentProjectPageUC)
|
|
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_MachinePageUC)
|
|
m_MainWindow.m_ActivePage = MainWindow.Pages.Machine
|
|
m_bIsClicked = True
|
|
Case MainWindow.Pages.RawPart
|
|
m_MainWindow.CadCutBtn.IsChecked = True
|
|
m_MainWindow.MachineBtn.IsChecked = False
|
|
Case MainWindow.Pages.Simulation
|
|
m_MainWindow.CadCutBtn.IsChecked = True
|
|
m_MainWindow.MachineBtn.IsChecked = False
|
|
Case MainWindow.Pages.Draw
|
|
m_MainWindow.CadCutBtn.IsChecked = True
|
|
m_MainWindow.MachineBtn.IsChecked = False
|
|
Case MainWindow.Pages.Import
|
|
m_MainWindow.CadCutBtn.IsChecked = True
|
|
m_MainWindow.MachineBtn.IsChecked = False
|
|
Case MainWindow.Pages.FrameCut
|
|
m_MainWindow.FrameCutBtn.IsChecked = False
|
|
m_MainWindow.MachineBtn.IsChecked = True
|
|
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(m_MainWindow.m_FrameCutPageUC)
|
|
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_CurrentProjectPageUC)
|
|
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_MachinePageUC)
|
|
m_MainWindow.m_ActivePage = MainWindow.Pages.Machine
|
|
m_bIsClicked = True
|
|
Case MainWindow.Pages.Machine
|
|
m_MainWindow.MachineBtn.IsChecked = True
|
|
m_bIsClicked = True
|
|
Case MainWindow.Pages.Options
|
|
m_MainWindow.MachineBtn.IsChecked = True
|
|
m_MainWindow.OptionsBtn.IsChecked = False
|
|
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_OptionsPageUC)
|
|
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_MachinePageUC)
|
|
m_MainWindow.m_ActivePage = MainWindow.Pages.Machine
|
|
m_bIsClicked = True
|
|
End Select
|
|
End Sub
|
|
|
|
Sub DisplayPositionName(sL1 As String, sL2 As String, sL3 As String, sR1 As String, sR2 As String)
|
|
Axis1NameTxBx.Text = sL1
|
|
Axis2NameTxBx.Text = sL2
|
|
Axis3NameTxBx.Text = sL3
|
|
Axis4NameTxBx.Text = sR1
|
|
Axis5NameTxBx.Text = sR2
|
|
End Sub
|
|
|
|
Sub DisplayPosition(nL1 As Integer, nL2 As Integer, nL3 As Integer, nR1 As Integer, nR2 As Integer)
|
|
' Recupero le posizioni macchina
|
|
Dim dL1 As Double = m_CN.d_axis_position(nL1)
|
|
Dim dL2 As Double = m_CN.d_axis_position(nL2)
|
|
Dim dL3 As Double = m_CN.d_axis_position(nL3)
|
|
Dim dR1 As Double = m_CN.d_axis_position(nR1)
|
|
Dim dR2 As Double = m_CN.d_axis_position(nR2)
|
|
' Se richiesto, le converto sul tip dell'utensile corrente rispetto allo Zero tavola
|
|
Dim ptTip As New Point3d
|
|
If m_bShowTipAxes AndAlso m_MainWindow.m_WorkInProgressPageUC.GetTipFromPositions(dL1, dL2, dL3, dR1, dR2, ptTip) Then
|
|
dL1 = ptTip.x
|
|
dL2 = ptTip.y
|
|
dL3 = ptTip.z
|
|
End If
|
|
' Visualizzazione
|
|
Axis1TxBx.Text = DoubleToString(dL1, -3)
|
|
Axis2TxBx.Text = DoubleToString(dL2, -3)
|
|
Axis3TxBx.Text = DoubleToString(dL3, -3)
|
|
Axis4TxBx.Text = DoubleToString(dR1, -3)
|
|
Axis5TxBx.Text = DoubleToString(dR2, -3)
|
|
End Sub
|
|
|
|
Sub DisplayPositionDelta(nL1 As Integer, nL2 As Integer, nL3 As Integer, nR1 As Integer, nR2 As Integer)
|
|
DeltaAxis1TxBx.Text = DoubleToString(m_CN.d_axis_delta(nL1), -3)
|
|
DeltaAxis2TxBx.Text = DoubleToString(m_CN.d_axis_delta(nL2), -3)
|
|
DeltaAxis3TxBx.Text = DoubleToString(m_CN.d_axis_delta(nL3), -3)
|
|
DeltaAxis4TxBx.Text = DoubleToString(m_CN.d_axis_delta(nR1), -3)
|
|
DeltaAxis5TxBx.Text = DoubleToString(m_CN.d_axis_delta(nR2), -3)
|
|
End Sub
|
|
|
|
Sub DisplayFeed()
|
|
Dim dRealFeed As Double = m_CN.d_DInterpo_Prog_Feed * m_CN.d_DInterpo_Feed_override / 100
|
|
FeedTxBx.Text = DoubleToString(dRealFeed, 0)
|
|
FeedOverrideTxBx.Text = DoubleToString(m_CN.d_DInterpo_Feed_override, 0) & "%"
|
|
End Sub
|
|
|
|
Sub DisplaySpeed()
|
|
If m_MainWindow.m_CNCommunication.m_nNCType = 3 Then 'se controllo Siemens
|
|
SpeedTxBx.Text = DoubleToString(m_CN.d_spindle_prog(0), 0)
|
|
Else
|
|
SpeedTxBx.Text = DoubleToString(m_CN.d_spindle_eff(0), 0)
|
|
End If
|
|
SpeedOverrideTxBx.Text = DoubleToString(m_CN.n_spindle_override(0), 0) & "%"
|
|
End Sub
|
|
|
|
Sub DisplayPower()
|
|
ConsumptionTxBx.Text = DoubleToString(m_CN.d_spindle_power, -2)
|
|
AOverrideTxBx.Text = DoubleToString(If(m_CN.bPowerOvr > 0, m_CN.d_spindle_power / m_CN.bPowerOvr * 100, 0), 0) & "%"
|
|
' AOverrideLbl
|
|
End Sub
|
|
|
|
Sub DisplayActiveMode(Mode As Integer)
|
|
Select Case Mode
|
|
Case 0
|
|
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Auto.png", UriKind.Relative))
|
|
Case 1
|
|
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Single.png", UriKind.Relative))
|
|
Case 2
|
|
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Mdi.png", UriKind.Relative))
|
|
Case 7
|
|
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Manual.png", UriKind.Relative))
|
|
Case 8
|
|
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Home.png", UriKind.Relative))
|
|
End Select
|
|
End Sub
|
|
|
|
Sub DisplayVar()
|
|
|
|
'For n As Short = 0 To 5 - 1
|
|
|
|
' lbl_var_values(n).Text = cn.d_Dvariable_values(n * 10).ToString
|
|
|
|
'Next
|
|
|
|
End Sub
|
|
|
|
End Class
|