diff --git a/AlarmsPageUC.xaml b/AlarmsPageUC.xaml index e5a189e..c3ee3af 100644 --- a/AlarmsPageUC.xaml +++ b/AlarmsPageUC.xaml @@ -32,45 +32,77 @@ - - - - - - - - + + - - + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - + + + + + + + + + + + + + + + + + + + - diff --git a/AlarmsPageUC.xaml.vb b/AlarmsPageUC.xaml.vb index 1f82adc..8208227 100644 --- a/AlarmsPageUC.xaml.vb +++ b/AlarmsPageUC.xaml.vb @@ -6,46 +6,106 @@ Public Class AlarmsPageUC ' Riferimento alla MainWindow Private m_MainWindow As MainWindow = Application.Current.MainWindow + Private m_CurrentMachine As CurrentMachine Friend m_CN As CN_generico ' Properties Private m_bFirst As Boolean = True 'Lista che contiene le lame disponibili (per Combobox pagina Alarms) - Friend SawList As New List(Of String) + Private m_SawList As New List(Of String) + Private m_DrillList As New List(Of String) + Private m_MillList As New List(Of String) + Private m_AuxToolTypeList As New List(Of String) Private Sub AlarmsPage_Initialized(sender As Object, e As EventArgs) 'Assegno liste a combobox - CurrSawCmBx.ItemsSource = SawList + CurrSawCmBx.ItemsSource = m_SawList + CurrDrillCmBx.ItemsSource = m_DrillList + CurrMillCmBx.ItemsSource = m_MillList + AuxiliaryToolCmBx.ItemsSource = m_AuxToolTypeList 'Imposto i messaggi letti dal file dei messaggi CurrSawTxBl.Text = "Lama corrente" - AuxiliaryToolTxBl.Text = "Secondo utensile" SafeZTxBl.Text = "Distanza di sicurezza" End Sub Private Sub AlarmsPage_Loaded(sender As Object, e As RoutedEventArgs) + ' Variabile che accorcia il riferimento alla macchina corrente + m_CurrentMachine = m_MainWindow.m_CurrentMachine + If Not m_MainWindow.m_bNCLink = 0 Then ErrorLstBx.ItemsSource = m_CN.sz_NC_error_messages End If ' Aggiorno lista delle lame per pagina macchina in cui scegliere quella corrente - SawList.Clear() - Dim ToolName As String = String.Empty - Dim nType As Integer = MCH_TY.NONE - If EgtTdbGetFirstTool(MCH_TF.SAWBLADE, ToolName, nType) Then - SawList.Add(ToolName) - While EgtTdbGetNextTool(MCH_TF.SAWBLADE, ToolName, nType) - SawList.Add(ToolName) - End While - End If + CreateToolList(MCH_TF.SAWBLADE, m_SawList) + ' Seleziono lama corrente + CurrSawCmBx.SelectedItem = m_CurrentMachine.sCurrSaw - ' Leggo lama corrente da file ini - GetPrivateProfileString(S_MACH, K_CURRSAW, "", ToolName, m_MainWindow.GetIniFile()) - CurrSawCmBx.SelectedItem = ToolName + ' Verifico la configurazione della macchina per creare i combobox + Select Case m_CurrentMachine.MountedToolConfig + Case CurrentMachine.MountedToolConfigs.SAW + 'Non eseguo alcuna azione + Case CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL + m_AuxToolTypeList.Add("Nessuno") + If m_CurrentMachine.bDrilling Then + m_AuxToolTypeList.Add("Fresatura") + If m_CurrentMachine.bMilling Then + m_AuxToolTypeList.Add("Foratura") + End If + Else + If m_CurrentMachine.bMilling Then + m_AuxToolTypeList.Add("Foratura") + End If + End If + + AuxiliaryToolTxBl.Visibility = Windows.Visibility.Visible + AuxiliaryToolCmBx.Visibility = Windows.Visibility.Visible + CurrDrillTxBl.Visibility = Windows.Visibility.Hidden + CurrDrillCmBx.Visibility = Windows.Visibility.Hidden + CurrMillTxBl.Visibility = Windows.Visibility.Hidden + CurrMillCmBx.Visibility = Windows.Visibility.Hidden + + If m_CurrentMachine.sCurrDrill <> String.Empty Then + AuxiliaryToolCmBx.SelectedItem = "Foratura" + CurrDrillTxBl.SetValue(Grid.RowProperty, 4) + CurrDrillCmBx.SetValue(Grid.RowProperty, 5) + CurrDrillTxBl.Visibility = Windows.Visibility.Visible + CurrDrillCmBx.Visibility = Windows.Visibility.Visible + ElseIf m_CurrentMachine.sCurrMill <> String.Empty Then + AuxiliaryToolCmBx.SelectedItem = "Fresatura" + CurrMillTxBl.Visibility = Windows.Visibility.Visible + CurrMillCmBx.Visibility = Windows.Visibility.Visible + Else + AuxiliaryToolCmBx.SelectedItem = "Nessuno" + End If + + Case CurrentMachine.MountedToolConfigs.SAWAND2AUXTOOLS, CurrentMachine.MountedToolConfigs.TOOLCHANGER + CreateToolList(MCH_TF.DRILLBIT, m_DrillList) + m_DrillList.Add("Nessuno") + CreateToolList(MCH_TF.MILL, m_MillList) + m_MillList.Add("Nessuna") + AuxiliaryToolTxBl.Visibility = Windows.Visibility.Hidden + AuxiliaryToolCmBx.Visibility = Windows.Visibility.Hidden + CurrDrillTxBl.Visibility = Windows.Visibility.Visible + CurrDrillCmBx.Visibility = Windows.Visibility.Visible + CurrMillTxBl.Visibility = Windows.Visibility.Visible + CurrMillCmBx.Visibility = Windows.Visibility.Visible + If m_CurrentMachine.sCurrDrill <> String.Empty Then + CurrDrillCmBx.SelectedItem = m_CurrentMachine.sCurrDrill + Else + CurrDrillCmBx.SelectedItem = "Nessuno" + End If + If m_CurrentMachine.sCurrMill <> String.Empty Then + CurrMillCmBx.SelectedItem = m_CurrentMachine.sCurrMill + Else + CurrMillCmBx.SelectedItem = "Nessuna" + End If + End Select ' Leggo distanza di sicurezza Dim dSafeZ As Double = 0 @@ -54,11 +114,94 @@ Public Class AlarmsPageUC End Sub + Private Sub AuxiliaryToolCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles AuxiliaryToolCmBx.SelectionChanged + Select Case AuxiliaryToolCmBx.SelectedItem + Case "Nessuno" + CurrDrillTxBl.Visibility = Windows.Visibility.Hidden + CurrDrillCmBx.Visibility = Windows.Visibility.Hidden + CurrMillTxBl.Visibility = Windows.Visibility.Hidden + CurrMillCmBx.Visibility = Windows.Visibility.Hidden + m_CurrentMachine.sCurrDrill = String.Empty + m_CurrentMachine.sCurrMill = String.Empty + Case "Foratura" + CreateToolList(MCH_TF.DRILLBIT, m_DrillList) + m_DrillList.Add("Nessuno") + CurrDrillTxBl.SetValue(Grid.RowProperty, 4) + CurrDrillCmBx.SetValue(Grid.RowProperty, 5) + If m_CurrentMachine.sCurrDrill = String.Empty Then + CurrDrillCmBx.SelectedItem = "Nessuno" + Else + CurrDrillCmBx.SelectedItem = m_CurrentMachine.sCurrDrill + End If + m_CurrentMachine.sCurrMill = String.Empty + CurrDrillTxBl.Visibility = Windows.Visibility.Visible + CurrDrillCmBx.Visibility = Windows.Visibility.Visible + CurrMillTxBl.Visibility = Windows.Visibility.Hidden + CurrMillCmBx.Visibility = Windows.Visibility.Hidden + Case "Fresatura" + CreateToolList(MCH_TF.MILL, m_MillList) + m_MillList.Add("Nessuna") + If m_CurrentMachine.sCurrMill = String.Empty Then + CurrMillCmBx.SelectedItem = "Nessuna" + Else + CurrMillCmBx.SelectedItem = m_CurrentMachine.sCurrMill + End If + m_CurrentMachine.sCurrDrill = String.Empty + CurrMillCmBx.SelectedItem = m_CurrentMachine.sCurrMill + CurrDrillTxBl.Visibility = Windows.Visibility.Hidden + CurrDrillCmBx.Visibility = Windows.Visibility.Hidden + CurrMillTxBl.Visibility = Windows.Visibility.Visible + CurrMillCmBx.Visibility = Windows.Visibility.Visible + End Select + End Sub + + Private Sub CurrSawCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrSawCmBx.SelectionChanged + 'WritePrivateProfileString(S_MACH, K_CURRSAW, CurrSawCmBx.SelectedItem, m_MainWindow.GetIniFile()) + m_CurrentMachine.sCurrSaw = CurrSawCmBx.SelectedItem + + End Sub + + Private Sub CurrDrillCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrDrillCmBx.SelectionChanged + If CurrDrillCmBx.SelectedItem = "Nessuno" Then + m_CurrentMachine.sCurrDrill = String.Empty + Else + m_CurrentMachine.sCurrDrill = CurrDrillCmBx.SelectedItem + If m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL Then + m_CurrentMachine.sCurrMill = String.Empty + End If + End If + End Sub + + Private Sub CurrMillCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrMillCmBx.SelectionChanged + If CurrMillCmBx.SelectedItem = "Nessuna" Then + m_CurrentMachine.sCurrMill = String.Empty + Else + m_CurrentMachine.sCurrMill = CurrMillCmBx.SelectedItem + If m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL Then + m_CurrentMachine.sCurrDrill = String.Empty + End If + + End If + End Sub + + Private Sub CreateToolList(ToolType As Integer, ToolList As List(Of String)) + 'SawList.Clear() + Dim ToolName As String = String.Empty + Dim nType As Integer = MCH_TY.NONE + If EgtTdbGetFirstTool(ToolType, ToolName, nType) Then + ToolList.Add(ToolName) + While EgtTdbGetNextTool(ToolType, ToolName, nType) + ToolList.Add(ToolName) + End While + End If + End Sub + + Friend Sub NcError() If m_CN.sz_NC_error_messages.Count > 0 Then NCErrorMessages.Text = m_CN.sz_NC_error_messages(0) If m_CN.bIsErrorMessage Then - m_MainWindow.m_MachineStatusUC.MachineStatusGrid.Background = Brushes.Red + m_MainWindow.m_MachineStatusUC.MachineStatusGrid.Background = Brushes.Red End If Else NCErrorMessages.Text = "" @@ -85,11 +228,6 @@ Public Class AlarmsPageUC End Sub - Private Sub CurrSawCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrSawCmBx.SelectionChanged - WritePrivateProfileString(S_MACH, K_CURRSAW, CurrSawCmBx.SelectedItem, m_MainWindow.GetIniFile()) - m_MainWindow.m_CurrentProjectPageUC.ToolTxBx.Text = CurrSawCmBx.SelectedItem - End Sub - Private Sub SafeZTxBx_EgtClosed(sender As Object, e As EventArgs) Handles SafeZTxBx.EgtClosed Dim dSafeZ As Double = 0 StringToDouble(SafeZTxBx.Text, dSafeZ) diff --git a/CN_Debug.vb b/CN_Debug.vb index 8011602..f61860d 100644 --- a/CN_Debug.vb +++ b/CN_Debug.vb @@ -1,10 +1,14 @@ Public Class CN_Debug Inherits CN_generico + ' Riferimento alla MainWindow + Private m_MainWindow As MainWindow = Application.Current.MainWindow + Sub New() End Sub Public Overrides Function Init() As Boolean + ' Assegno valori ad assi per test d_axis_position(0) = -1500 d_axis_position(1) = -1300 @@ -12,6 +16,9 @@ d_axis_position(8) = 67.315 d_axis_position(7) = 90.0 + 'Assegno icona modalità auto alla barra della macchina + m_MainWindow.m_MachineStatusUC.MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Auto.png", UriKind.Relative)) + Return True End Function diff --git a/CamAuto.vb b/CamAuto.vb index 3eff6d7..ed2aa69 100644 --- a/CamAuto.vb +++ b/CamAuto.vb @@ -6,7 +6,7 @@ Public Module CamAuto Public Function AddMachinings(nPartId As Integer, bPreview As Boolean, bToolpath As Boolean) As Boolean Dim sSawMch As String = String.Empty - GetPrivateProfileString(S_MACH, K_CURRMACHINING, "", sSawMch, m_MainWindow.GetIniFile()) + GetPrivateProfileString(S_MACH, K_CURRSAWING, "", sSawMch, m_MainWindow.GetIniFile()) Dim sDrillMch As String = String.Empty GetPrivateProfileString(S_MACH, K_CURRDRILLING, "", sDrillMch, m_MainWindow.GetIniFile()) EgtLuaCreateGlobTable("CAM") diff --git a/ChooseMachining.xaml b/ChooseMachining.xaml new file mode 100644 index 0000000..d6aa9f7 --- /dev/null +++ b/ChooseMachining.xaml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ChooseMachining.xaml.vb b/ChooseMachining.xaml.vb new file mode 100644 index 0000000..18258fc --- /dev/null +++ b/ChooseMachining.xaml.vb @@ -0,0 +1,191 @@ +Imports EgtUILib + +Public Class ChooseMachining + + ' Riferimento alla MainWindow + Private m_MainWindow As MainWindow = Application.Current.MainWindow + Private m_CurrentMachine As CurrentMachine = m_MainWindow.m_CurrentMachine + ' Liste che contengono gli elementi appartenenti alle ComboBox + Private m_SawingList As New List(Of String) + Private m_AuxiliaryMachiningTypeList As New List(Of String) + Private m_DrillingList As New List(Of String) + Private m_MillingList As New List(Of String) + ' Numero righe della finestra, necessario per non ridimensionarla quando si cambia il tipo di utensile ausiliario + Private m_RowNumber As Integer = 6 + + Sub New(Owner As Window) + Me.Owner = Owner + InitializeComponent() + ShowDialog() + End Sub + + Private Sub ChooseMachining_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized + Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2 + Me.Left = Owner.Left + Owner.Width / 2 - Me.Width / 2 + CurrSawingCmBx.ItemsSource = m_SawingList + AuxiliaryMachiningCmBx.ItemsSource = m_AuxiliaryMachiningTypeList + CurrDrillingCmBx.ItemsSource = m_DrillingList + CurrMillingCmBx.ItemsSource = m_MillingList + End Sub + + Private Sub ChooseMachining_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded + InitializeMachiningLists() + End Sub + + Private Sub InitializeMachiningLists() + + 'Creo lista lavorazioni di lama + CreateMachiningList(MCH_MY.SAWING, m_CurrentMachine.sCurrSaw, m_SawingList) + + ' Verifico la configurazione della macchina per creare i combobox + Select Case m_CurrentMachine.MountedToolConfig + Case CurrentMachine.MountedToolConfigs.SAW + ChooseMachiningGrid.Children.Remove(AuxiliaryMachiningTxBl) + ChooseMachiningGrid.Children.Remove(AuxiliaryMachiningCmBx) + Case CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL, CurrentMachine.MountedToolConfigs.SAWAND2AUXTOOLS, CurrentMachine.MountedToolConfigs.TOOLCHANGER + ' Definizione di due riga della tabella con la giusta altezza + For Index = 0 To 1 + Dim Row As New RowDefinition + Row.Height = New GridLength(0.5, GridUnitType.Star) + ChooseMachiningGrid.RowDefinitions.Add(Row) + Next + AuxiliaryMachiningTxBl.SetValue(Grid.RowProperty, 2) + AuxiliaryMachiningCmBx.SetValue(Grid.RowProperty, 3) + ButtonsGrid.SetValue(Grid.RowProperty, 5) + AuxiliaryMachiningTxBl.Visibility = Windows.Visibility.Visible + AuxiliaryMachiningCmBx.Visibility = Windows.Visibility.Visible + Me.Height = 341.2 + m_RowNumber += 2 + End Select + CurrSawingCmBx.SelectedItem = If(Not IsNothing(m_SawingList(0)), m_SawingList(0), Nothing) + + m_AuxiliaryMachiningTypeList.Add("Nessuna") + If m_CurrentMachine.bDrilling Then + m_AuxiliaryMachiningTypeList.Add("Fresatura") + If m_CurrentMachine.bMilling Then + m_AuxiliaryMachiningTypeList.Add("Foratura") + If m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.SAWAND2AUXTOOLS Or m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGER Then + m_AuxiliaryMachiningTypeList.Add("Entrambe") + End If + End If + Else + If m_CurrentMachine.bMilling Then + m_AuxiliaryMachiningTypeList.Add("Foratura") + End If + End If + AuxiliaryMachiningCmBx.SelectedItem = "Nessuna" + + End Sub + + Private Sub CreateMachiningList(MachiningType As Integer, CurrTool As String, MachiningList As List(Of String)) + 'Cerco tutte le lavorazioni che utilizzano l'utensile corrente le aggiungo alla lista + Dim MachiningTool As String = String.Empty + Dim MachiningName As String = String.Empty + If EgtMdbGetFirstMachining(MachiningType, MachiningName) Then + EgtMdbSetCurrMachining(MachiningName) + EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, MachiningTool) + If MachiningTool = CurrTool Then + MachiningList.Add(MachiningName) + End If + While EgtMdbGetNextMachining(MachiningType, MachiningName) + EgtMdbSetCurrMachining(MachiningName) + EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, MachiningTool) + If MachiningTool = CurrTool Then + MachiningList.Add(MachiningName) + End If + End While + End If + + End Sub + + Private Sub AuxiliaryMachiningCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles AuxiliaryMachiningCmBx.SelectionChanged + Select Case AuxiliaryMachiningCmBx.SelectedItem + Case "Nessuna" + If m_RowNumber > 8 Then + For Index = m_RowNumber - 1 To 8 Step -1 + ChooseMachiningGrid.RowDefinitions.RemoveAt(Index) + Next + m_RowNumber = 8 + End If + ButtonsGrid.SetValue(Grid.RowProperty, 5) + CurrDrillingTxBl.Visibility = Windows.Visibility.Hidden + CurrDrillingCmBx.Visibility = Windows.Visibility.Hidden + CurrMillingTxBl.Visibility = Windows.Visibility.Hidden + CurrMillingCmBx.Visibility = Windows.Visibility.Hidden + Me.Height = 341.2 + Case "Foratura" + ' Definizione di due riga della tabella con la giusta altezza + If m_RowNumber < 10 Then + For Index = 1 To 10 - m_RowNumber + Dim Row As New RowDefinition + Row.Height = New GridLength(0.5, GridUnitType.Star) + ChooseMachiningGrid.RowDefinitions.Add(Row) + Next + m_RowNumber = 10 + End If + CurrDrillingTxBl.SetValue(Grid.RowProperty, 4) + CurrDrillingCmBx.SetValue(Grid.RowProperty, 5) + ButtonsGrid.SetValue(Grid.RowProperty, 7) + CreateMachiningList(MCH_MY.DRILLING, m_CurrentMachine.sCurrDrill, m_DrillingList) + CurrDrillingTxBl.Visibility = Windows.Visibility.Visible + CurrDrillingCmBx.Visibility = Windows.Visibility.Visible + CurrMillingTxBl.Visibility = Windows.Visibility.Hidden + CurrMillingCmBx.Visibility = Windows.Visibility.Hidden + Me.Height = 426.5 + Case "Fresatura" + ' Definizione di due riga della tabella con la giusta altezza + If m_RowNumber < 10 Then + For Index = 1 To 10 - m_RowNumber + Dim Row As New RowDefinition + Row.Height = New GridLength(0.5, GridUnitType.Star) + ChooseMachiningGrid.RowDefinitions.Add(Row) + Next + m_RowNumber = 10 + End If + CurrMillingTxBl.SetValue(Grid.RowProperty, 4) + CurrMillingCmBx.SetValue(Grid.RowProperty, 5) + ButtonsGrid.SetValue(Grid.RowProperty, 7) + CreateMachiningList(MCH_MY.MILLING, m_CurrentMachine.sCurrMill, m_MillingList) + CurrDrillingTxBl.Visibility = Windows.Visibility.Hidden + CurrDrillingCmBx.Visibility = Windows.Visibility.Hidden + CurrMillingTxBl.Visibility = Windows.Visibility.Visible + CurrMillingCmBx.Visibility = Windows.Visibility.Visible + Me.Height = 426.5 + Case "Entrambe" + ' Definizione di quattro riga della tabella con la giusta altezza + If m_RowNumber < 12 Then + For Index = 1 To 12 - m_RowNumber + Dim Row As New RowDefinition + Row.Height = New GridLength(0.5, GridUnitType.Star) + ChooseMachiningGrid.RowDefinitions.Add(Row) + Next + m_RowNumber = 12 + End If + CurrDrillingTxBl.SetValue(Grid.RowProperty, 4) + CurrDrillingCmBx.SetValue(Grid.RowProperty, 5) + CurrMillingTxBl.SetValue(Grid.RowProperty, 6) + CurrMillingCmBx.SetValue(Grid.RowProperty, 7) + ButtonsGrid.SetValue(Grid.RowProperty, 9) + CreateMachiningList(MCH_MY.DRILLING, m_CurrentMachine.sCurrDrill, m_DrillingList) + CreateMachiningList(MCH_MY.MILLING, m_CurrentMachine.sCurrMill, m_MillingList) + CurrDrillingTxBl.Visibility = Windows.Visibility.Visible + CurrDrillingCmBx.Visibility = Windows.Visibility.Visible + CurrMillingTxBl.Visibility = Windows.Visibility.Visible + CurrMillingCmBx.Visibility = Windows.Visibility.Visible + Me.Height = 511.8 + End Select + End Sub + + Private Sub CurrSawingCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrSawingCmBx.SelectionChanged + m_MainWindow.m_CurrentMachine.sCurrSawing = CurrSawingCmBx.SelectedItem + End Sub + + Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click + DialogResult = True + End Sub + + Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click + DialogResult = False + End Sub + +End Class diff --git a/ConstIni.vb b/ConstIni.vb index 1ee6ffc..0457528 100644 --- a/ConstIni.vb +++ b/ConstIni.vb @@ -114,8 +114,11 @@ Module ConstIni Public Const K_TOOLMAKERSDIR As String = "ToolMakersDir" Public Const K_CURRMACH As String = "CurrMach" Public Const K_CURRSAW As String = "CurrSaw" - Public Const K_CURRMACHINING As String = "CurrMachining" + Public Const K_CURRDRILL As String = "CurrDrill" + Public Const K_CURRMILL As String = "CurrMill" + Public Const K_CURRSAWING As String = "CurrSawing" Public Const K_CURRDRILLING As String = "CurrDrilling" + Public Const K_CURRMILLING As String = "CurrMilling" Public Const S_SIMUL As String = "Simul" Public Const K_SLIDERX As String = "SliderX" diff --git a/ConstMachIni.vb b/ConstMachIni.vb index 8bdf77e..9bb7ce8 100644 --- a/ConstMachIni.vb +++ b/ConstMachIni.vb @@ -41,6 +41,7 @@ Public Const K_DRILLMAKER As String = "DrillMaker" Public Const K_SAWBLADEMAKER As String = "SawBladeMaker" Public Const K_MILLMAKER As String = "MillMaker" + Public Const K_MOUNTEDTOOLCONFIG As String = "MountedToolConfig" Public Const S_MACHININGS As String = "Machinings" Public Const K_DRILLING As String = "Drilling" diff --git a/CurrentMachine.vb b/CurrentMachine.vb new file mode 100644 index 0000000..4cc0841 --- /dev/null +++ b/CurrentMachine.vb @@ -0,0 +1,269 @@ +Imports EgtUILib + +Public Class CurrentMachine + + ' Riferimento alla MainWindow + Private m_MainWindow As MainWindow = Application.Current.MainWindow + + ' Nome macchina corrente + Private m_sMachineName As String + + ' File ini della macchina + Private m_sMachIniFile As String + + ' Numero e tipo di utensili correntemente disponibili sulla macchina + Private m_MountedToolConfig As MountedToolConfigs + + ' Distanza di sicurezza + Private m_dSafeZ As Double + + ' Flag che indicano stato tipologia utensili (attivo/non attivo) + Private m_bSaw As Boolean + Private m_bDrill As Boolean + Private m_bMill As Boolean + + 'Flag che indicano presenza tipologia lavorazioni (attivo/non attivo) + Private m_bSawing As Boolean + Private m_bDrilling As Boolean + Private m_bMilling As Boolean + + ' Variabili che nel caso di porta utensili indicano quanti utensili possono essere ospitati per tipo + + ' Variabili che contengono il nome degli utensili disponibili per tipo + Private m_sCurrSaw(0) As String + Private m_sCurrDrill(0) As String + Private m_sCurrMill(0) As String + + ' Variabili che contengono le lavorazioni correntemente attive (utilizzate per definire lavorazioni nel programma) + Private m_sCurrSawing As String + Private m_sCurrDrilling As String + Private m_sCurrMilling As String + + ' Spessore sottopezzo + Private m_dAdditionalTable As Double + + Friend Enum MountedToolConfigs As Integer + SAW = 0 + SAWANDAUXTOOL = 1 + SAWAND2AUXTOOLS = 2 + TOOLCHANGER = 3 + End Enum + +#Region "Proprietà che leggono e scrivono i valori anche da o su file ini" + + Friend ReadOnly Property sMachineName As String + Get + Return m_sMachineName + End Get + End Property + + Friend ReadOnly Property sMachIniFile As String + Get + Return m_sMachIniFile + End Get + End Property + + Friend ReadOnly Property MountedToolConfig As MountedToolConfigs + Get + Return m_MountedToolConfig + End Get + End Property + + Friend Property dSafeZ As Double + Get + If EgtMdbGetSafeZ(m_dSafeZ) Then + Return m_dSafeZ + Else + Return Nothing + End If + End Get + Set(value As Double) + If EgtMdbSetSafeZ(value) And + EgtMdbSave() Then + m_dSafeZ = value + End If + End Set + End Property + + Friend ReadOnly Property bSaw As Boolean + Get + Return m_bSaw + End Get + End Property + + Friend ReadOnly Property bDrill As Boolean + Get + Return m_bDrill + End Get + End Property + + Friend ReadOnly Property bMill As Boolean + Get + Return m_bMill + End Get + End Property + + Friend ReadOnly Property bSawing As Boolean + Get + Return m_bSawing + End Get + End Property + + Friend ReadOnly Property bDrilling As Boolean + Get + Return m_bDrilling + End Get + End Property + + Friend ReadOnly Property bMilling As Boolean + Get + Return m_bMilling + End Get + End Property + + Friend Property sCurrSaw As String + Get + Return m_sCurrSaw(0) + End Get + Set(value As String) + If WritePrivateProfileString(S_MACH, K_CURRSAW, value, m_MainWindow.GetIniFile()) Then + m_sCurrSaw(0) = value + m_MainWindow.m_CurrentProjectPageUC.ToolTxBx.Text = value + End If + End Set + End Property + + Friend Property sCurrDrill As String + Get + Return m_sCurrDrill(0) + End Get + Set(value As String) + If WritePrivateProfileString(S_MACH, K_CURRDRILL, value, m_MainWindow.GetIniFile()) Then + m_sCurrDrill(0) = value + End If + End Set + End Property + + Friend Property sCurrMill As String + Get + Return m_sCurrMill(0) + End Get + Set(value As String) + If WritePrivateProfileString(S_MACH, K_CURRMILL, value, m_MainWindow.GetIniFile()) Then + m_sCurrMill(0) = value + End If + End Set + End Property + + Friend Property sCurrSawing As String + Get + Return m_sCurrSawing + End Get + Set(value As String) + If WritePrivateProfileString(S_MACH, K_CURRSAWING, value, m_MainWindow.GetIniFile()) Then + m_sCurrSawing = value + End If + End Set + End Property + + Friend Property sCurrDrilling As String + Get + Return m_sCurrDrilling + End Get + Set(value As String) + If WritePrivateProfileString(S_MACH, K_CURRDRILLING, value, m_MainWindow.GetIniFile()) Then + m_sCurrDrilling = value + End If + End Set + End Property + + Friend Property sCurrMilling As String + Get + Return m_sCurrMilling + End Get + Set(value As String) + If WritePrivateProfileString(S_MACH, K_CURRMILLING, value, m_MainWindow.GetIniFile()) Then + m_sCurrMilling = value + End If + End Set + End Property + + Friend Property dAdditionalTable As Double + Get + Return m_dAdditionalTable + End Get + Set(value As Double) + If WritePrivateProfileString(S_TABLE, K_ADDITIONALTABLE, value, sMachIniFile) Then + m_sCurrMilling = value + End If + End Set + End Property + +#End Region + + Sub New() + + ' Leggo da file ini nome macchina corrente + GetPrivateProfileString(S_MACH, K_CURRMACH, "", m_sMachineName, m_MainWindow.GetIniFile()) + ' Impostazione path MachIni file + m_sMachIniFile = m_MainWindow.GetMachinesRootDir & "\" & sMachineName & "\" & sMachineName & ".ini" + ' Leggo configurazione degli utensili in macchina + m_MountedToolConfig = GetPrivateProfileInt(S_TOOLS, K_MOUNTEDTOOLCONFIG, 0, sMachIniFile) + ' Leggo flag presenza tipologie utensili + ' lama + If GetPrivateProfileInt(S_TOOLS, K_SAWBLADE, Nothing, sMachIniFile) > 0 Then + m_bSaw = True + Else + m_bSaw = False + End If + ' foretto + If GetPrivateProfileInt(S_TOOLS, K_DRILLBIT, Nothing, sMachIniFile) > 0 Then + m_bDrill = True + Else + m_bDrill = False + End If + ' fresa + If GetPrivateProfileInt(S_TOOLS, K_MILL, Nothing, sMachIniFile) > 0 Then + m_bMill = True + Else + m_bMill = False + End If + ' Leggo flag presenza tipologie lavorazioni + ' lama + If GetPrivateProfileInt(S_MACHININGS, K_SAWING, Nothing, sMachIniFile) > 0 Then + m_bSawing = True + Else + m_bSawing = False + End If + ' foretto + If GetPrivateProfileInt(S_MACHININGS, K_DRILLING, Nothing, sMachIniFile) > 0 Then + m_bDrilling = True + Else + m_bDrilling = False + End If + ' fresa + If GetPrivateProfileInt(S_MACHININGS, K_MILLING, Nothing, sMachIniFile) > 0 Then + m_bMilling = True + Else + m_bMilling = False + End If + + ' Leggo utensili correnti + ' lama + GetPrivateProfileString(S_MACH, K_CURRSAW, Nothing, m_sCurrSaw(0), m_MainWindow.GetIniFile()) + ' foretto + GetPrivateProfileString(S_MACH, K_CURRDRILL, Nothing, m_sCurrDrill(0), m_MainWindow.GetIniFile()) + ' fresa + GetPrivateProfileString(S_MACH, K_CURRMILL, Nothing, m_sCurrMill(0), m_MainWindow.GetIniFile()) + + ' Leggo lavorazioni correnti + ' lama + GetPrivateProfileString(S_MACH, K_CURRSAWING, Nothing, m_sCurrSawing, m_MainWindow.GetIniFile()) + ' foretto + GetPrivateProfileString(S_MACH, K_CURRDRILLING, Nothing, m_sCurrDrilling, m_MainWindow.GetIniFile()) + ' fresa + GetPrivateProfileString(S_MACH, K_CURRMILLING, Nothing, m_sCurrMilling, m_MainWindow.GetIniFile()) + + End Sub + +End Class diff --git a/CurrentProjectPageUC.xaml.vb b/CurrentProjectPageUC.xaml.vb index a199bd5..d3efc4d 100644 --- a/CurrentProjectPageUC.xaml.vb +++ b/CurrentProjectPageUC.xaml.vb @@ -145,7 +145,7 @@ Public Class CurrentProjectPageUC End If Dim sCurrMach As String = String.Empty - GetPrivateProfileString(S_MACH, K_CURRMACHINING, "", sCurrMach, m_MainWindow.GetIniFile()) + GetPrivateProfileString(S_MACH, K_CURRSAWING, "", sCurrMach, m_MainWindow.GetIniFile()) MachiningTxBx.Text = sCurrMach End Sub diff --git a/DirectCutPageUC.xaml b/DirectCutPageUC.xaml index 6f57bb3..d0de119 100644 --- a/DirectCutPageUC.xaml +++ b/DirectCutPageUC.xaml @@ -57,6 +57,10 @@ + +