b4faf1dd54
- modifiche per gestione mm/inches anche con la macchina - modifiche per gestione controllo Num Axium.
216 lines
10 KiB
VB.net
216 lines
10 KiB
VB.net
Imports System.ComponentModel
|
|
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)
|
|
If m_MainWindow.m_dHorScale < 1 Then
|
|
MachineStatusImage.Height *= m_MainWindow.m_dHorScale
|
|
MachineStatusImage.Width *= m_MainWindow.m_dHorScale
|
|
Axis1NameTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
Axis1TxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
DeltaAxis1TxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
Axis2NameTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
Axis2TxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
DeltaAxis2TxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
Axis3NameTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
Axis3TxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
DeltaAxis3TxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
Axis4NameTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
Axis4TxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
DeltaAxis4TxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
Axis5NameTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
Axis5TxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
DeltaAxis5TxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
FeedNameTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
FeedTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
FeedOverrideNameTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
FeedOverrideTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
SpeedNameTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
SpeedTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
SpeedOverrideNameTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
SpeedOverrideTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
ConsumptionNameTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
ConsumptionTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
AOverrideTxBx.FontSize *= m_MainWindow.m_dHorScale
|
|
End If
|
|
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()
|
|
' Recupero i nomi delgi assi macchina
|
|
Dim sL1 As String = String.Empty
|
|
Dim sL2 As String = String.Empty
|
|
Dim sL3 As String = String.Empty
|
|
Dim sR1 As String = String.Empty
|
|
Dim sR2 As String = String.Empty
|
|
m_MainWindow.m_CNCommunication.GetAxesNames(sL1, sL2, sL3, sR1, sR2)
|
|
Axis1NameTxBx.Text = sL1
|
|
Axis2NameTxBx.Text = sL2
|
|
Axis3NameTxBx.Text = sL3
|
|
Axis4NameTxBx.Text = sR1
|
|
Axis5NameTxBx.Text = sR2
|
|
End Sub
|
|
|
|
Sub DisplayPosition()
|
|
' Recupero le posizioni macchina
|
|
Dim dL1, dL2, dL3, dR1, dR2 As Double
|
|
m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2)
|
|
' 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 = LenToString(dL1, -3)
|
|
Axis2TxBx.Text = LenToString(dL2, -3)
|
|
Axis3TxBx.Text = LenToString(dL3, -3)
|
|
Axis4TxBx.Text = DoubleToString(dR1, -3)
|
|
Axis5TxBx.Text = DoubleToString(dR2, -3)
|
|
End Sub
|
|
|
|
Sub DisplayPositionDelta()
|
|
' Recupero le posizioni macchina
|
|
Dim dL1, dL2, dL3, dR1, dR2 As Double
|
|
m_MainWindow.m_CNCommunication.GetAxesDeltas(dL1, dL2, dL3, dR1, dR2)
|
|
' Visualizzazione
|
|
DeltaAxis1TxBx.Text = LenToString(dL1, -3)
|
|
DeltaAxis2TxBx.Text = LenToString(dL2, -3)
|
|
DeltaAxis3TxBx.Text = LenToString(dL3, -3)
|
|
DeltaAxis4TxBx.Text = DoubleToString(dR1, -3)
|
|
DeltaAxis5TxBx.Text = DoubleToString(dR2, -3)
|
|
End Sub
|
|
|
|
Sub DisplayFeed()
|
|
Dim dRealFeed As Double = m_CN.d_DInterpo_Prog_Feed * m_CN.d_DInterpo_Feed_override / 100
|
|
'Feed = DoubleToString(dRealFeed, 0)
|
|
FeedTxBx.Text = LenToString(dRealFeed, 0)
|
|
'FeedOverride = DoubleToString(m_CN.d_DInterpo_Feed_override, 0) & "%"
|
|
Dim dFeedOverride As Double = m_CN.d_DInterpo_Feed_override
|
|
FeedOverrideTxBx.Text = DoubleToString(dFeedOverride, 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
|
|
Dim dSpeed As Double = m_CN.d_spindle_eff(0)
|
|
SpeedTxBx.Text = DoubleToString(dSpeed, 0)
|
|
End If
|
|
Dim dSpindleOverride As Integer = m_CN.n_spindle_override(0)
|
|
SpeedOverrideTxBx.Text = DoubleToString(dSpindleOverride, 0) & "%"
|
|
End Sub
|
|
|
|
Sub DisplayPower()
|
|
Dim dSpindlePower = m_CN.d_spindle_power
|
|
ConsumptionTxBx.Text = DoubleToString(dSpindlePower, -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
|