From fcf583567cb0d499d78a3239ee345ac06a617465 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Fri, 21 Apr 2017 16:34:44 +0000 Subject: [PATCH] EgtCAM5 : - Aggiunta errori di disegno utensili. - Uscita da simulazione solo se in pausa. --- Application.xaml.vb | 2 ++ IniFile.vb | 2 ++ MTableDb/MTableListBox.vb | 9 --------- MainWindow/MainWindowViewModel.vb | 7 ++++++- .../SimulationExpanderViewModel.vb | 17 ++++++++++++++++ ToolsDbWindow/ToolTreeView.vb | 20 +++++++++++++++++++ TopCommandBar/TopCommandBarView.xaml | 2 +- TopCommandBar/TopCommandBarViewModel.vb | 14 +++++++++++++ 8 files changed, 62 insertions(+), 11 deletions(-) diff --git a/Application.xaml.vb b/Application.xaml.vb index 9ff51a6..53b9c9a 100644 --- a/Application.xaml.vb +++ b/Application.xaml.vb @@ -171,6 +171,7 @@ Class Application Friend Const SIMULATIONEXPANDER_UPDATE_CNCDATA As String = "SimulationExpander_Update_CncData" Friend Const CANCELOPERATIONCOMMAND As String = "CancelOperationCommand" Friend Const UPDATEOPERATIONMACHININGLIST As String = "UpdateOperationMachiningList" + Friend Const CANCLOSEAPPFROMSIMUL As String = "CanCloseAppFromSimul" ' StatusBar messages Friend Const STATUSGRIDCOMMAND As String = "StatusGridCommand" @@ -193,6 +194,7 @@ Class Application Friend Const IMPORTPROJECT As String = "ImportProject" Friend Const EXPORTPROJECT As String = "ExportProject" Friend Const EXECSCRIPT As String = "ExecScript" + Friend Const SETDRAWISENABLED As String = "SetDrawIsEnabled" ' Special ' Door diff --git a/IniFile.vb b/IniFile.vb index aa81080..5cdb1ab 100644 --- a/IniFile.vb +++ b/IniFile.vb @@ -97,6 +97,8 @@ Public Module IniFile Friend m_bFailedRun As Boolean ' Variabile che contiene il vettore di traslazione dei pezzi nel passaggio da modalità diegna a lavora Friend m_vtMachPartsPos As New Vector3d(Vector3d.NULL) + ' Variabile che contiene stato simulazione per chiusura programma + Friend m_bSimulStatForClose As Boolean = True Public Function GetPrivateProfileInt(IpAppName As String, IpKeyName As String, nDefault As Integer) As Integer Return EgtUILib.GetPrivateProfileInt(IpAppName, IpKeyName, nDefault, m_sIniFile) diff --git a/MTableDb/MTableListBox.vb b/MTableDb/MTableListBox.vb index 13882fe..6324989 100644 --- a/MTableDb/MTableListBox.vb +++ b/MTableDb/MTableListBox.vb @@ -754,9 +754,6 @@ Public Class MTableAssociationGridBoxItem m_ChiselingList.Add(New List(Of String)) Next End If - ''If m_MachinesMachTypeList.Count = 0 Then - '' m_MachinesMachTypeList.Add(New List(Of MachineModel.MachiningsType)) - ''End If OnPar = bOn ' Inizializzo la lista dei nomi solo la prima volta If IsNothing(m_NamesList) Then @@ -802,12 +799,6 @@ Public Class MTableAssociationGridBoxItem OperationsList = New ObservableCollection(Of String)(TempOperList) End If Oper = sOper - ' '' Inizializzo la lista di tipi di lavorazione solo la prima volta - ''If IsNothing(m_MachTypeList) Then - '' MachTypeList = New ObservableCollection(Of MachiningsType)(MachineModel.ReadActiveMachiningsFamilies()) - '' ' aggiungo elemento stringa vuota(come primo elemento) per dare la possibilità di non selezionarne nessuna operazione - '' MachTypeList.Insert(0, New MachiningsType() With {.TypeId = MCH_MY.NONE, .TypeName = String.Empty}) - ''End If ' dall'MId recupero la macchina a cui si riferisce questa associazione e la imposto come corrente EgtSetCurrMachine(m_ActiveMachinesList(m_MachId - 1).SelectedMachine) ' Imposto MachType selezionato cercando il tipo delle lavorazioni diff --git a/MainWindow/MainWindowViewModel.vb b/MainWindow/MainWindowViewModel.vb index 42b9c8d..b7fd04d 100644 --- a/MainWindow/MainWindowViewModel.vb +++ b/MainWindow/MainWindowViewModel.vb @@ -138,12 +138,17 @@ Namespace EgtCAM5 ''' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded. ''' Public Sub CloseApplication(ByVal param As Object) - If m_bScriptRunning Then + If IniFile.m_bScriptRunning Then If Not IniFile.m_bFailedRun Then 'MessageBox.Show("Can't exit now. Wait until the end of the script execution", "", MessageBoxButton.OK, MessageBoxImage.Stop) Return End If End If + Application.Msn.NotifyColleagues(Application.CANCLOSEAPPFROMSIMUL) + If Not IniFile.m_bSimulStatForClose Then + MessageBox.Show(EgtMsg(MSG_SIMULATION + 13), "", MessageBoxButton.OK, MessageBoxImage.Exclamation) + Return + End If '' Gestisco eventuale file corrente modificato Application.Msn.NotifyColleagues(Application.MANAGEMODIFIED) If m_allowWindowToClose Then diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb b/ProjectPage/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb index 6b15aa4..37f169f 100644 --- a/ProjectPage/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb +++ b/ProjectPage/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb @@ -37,6 +37,11 @@ Namespace EgtCAM5 m_MachineAxisList(Index).IsReadOnlyAxesValue = True Next End If + If value = SIM_ST.ST_PAUSE OrElse value = SIM_ST.ST_STOP Then + Application.Msn.NotifyColleagues(Application.SETDRAWISENABLED, True) + Else + Application.Msn.NotifyColleagues(Application.SETDRAWISENABLED, False) + End If End Set End Property @@ -213,6 +218,9 @@ Namespace EgtCAM5 ShowCncData() End If End Sub) + Application.Msn.Register(Application.CANCLOSEAPPFROMSIMUL, Sub() + IniFile.m_bSimulStatForClose = CanCloseApplication() + End Sub) End Sub #End Region @@ -560,6 +568,15 @@ Namespace EgtCAM5 End If End Sub + Private Function CanCloseApplication() As Boolean + If m_IsExpanded Then + If m_nStatus = SIM_ST.ST_PLAY Or m_nStatus = SIM_ST.ST_STEP Then + Return False + End If + End If + Return True + End Function + #End Region End Class diff --git a/ToolsDbWindow/ToolTreeView.vb b/ToolsDbWindow/ToolTreeView.vb index 9e91aa3..0a0ac6a 100644 --- a/ToolsDbWindow/ToolTreeView.vb +++ b/ToolsDbWindow/ToolTreeView.vb @@ -1808,6 +1808,26 @@ Public Class ToolTreeViewItem End If If m_nDrawingError = 12 Then m_DrawError = EgtMsg(MSG_TOOLSERRORS + 21) ' Utensile troppo corto con il portautensile + ElseIf m_nDrawingError = 13 Then + m_DrawError = EgtMsg(MSG_TOOLSERRORS + 31) + ElseIf m_nDrawingError = 14 Then + m_DrawError = EgtMsg(MSG_TOOLSERRORS + 32) + ElseIf m_nDrawingError = 15 Then + m_DrawError = EgtMsg(MSG_TOOLSERRORS + 33) + ElseIf m_nDrawingError = 16 Then + m_DrawError = EgtMsg(MSG_TOOLSERRORS + 35) + ElseIf m_nDrawingError = 17 Then + m_DrawError = EgtMsg(MSG_TOOLSERRORS + 36) + ElseIf m_nDrawingError = 18 Then + m_DrawError = EgtMsg(MSG_TOOLSERRORS + 37) + ElseIf m_nDrawingError = 19 Then + m_DrawError = EgtMsg(MSG_TOOLSERRORS + 38) + ElseIf m_nDrawingError = 20 Then + m_DrawError = EgtMsg(MSG_TOOLSERRORS + 39) + ElseIf m_nDrawingError = 21 Then + m_DrawError = EgtMsg(MSG_TOOLSERRORS + 40) + ElseIf m_nDrawingError = 22 Then + m_DrawError = EgtMsg(MSG_TOOLSERRORS + 34) ElseIf m_nDrawingError <> 0 Then m_DrawError = EgtMsg(MSG_TOOLSERRORS + 5) End If diff --git a/TopCommandBar/TopCommandBarView.xaml b/TopCommandBar/TopCommandBarView.xaml index 4dfbf43..8bd072b 100644 --- a/TopCommandBar/TopCommandBarView.xaml +++ b/TopCommandBar/TopCommandBarView.xaml @@ -50,7 +50,7 @@ + IsChecked="{Binding DrawIsChecked}" IsEnabled="{Binding DrawIsEnabled}"/> diff --git a/TopCommandBar/TopCommandBarViewModel.vb b/TopCommandBar/TopCommandBarViewModel.vb index 8afc1a2..d79a995 100644 --- a/TopCommandBar/TopCommandBarViewModel.vb +++ b/TopCommandBar/TopCommandBarViewModel.vb @@ -122,6 +122,17 @@ Namespace EgtCAM5 End Set End Property + Private m_DrawIsEnabled As Boolean = True + Public Property DrawIsEnabled As Boolean + Get + Return m_DrawIsEnabled + End Get + Set(value As Boolean) + m_DrawIsEnabled = value + OnPropertyChanged("DrawIsEnabled") + End Set + End Property + Private m_MachiningIsEnabled As Boolean Public Property MachiningIsEnabled As Boolean Get @@ -195,6 +206,9 @@ Namespace EgtCAM5 MachiningIsEnabled = True End If End Sub) + Application.Msn.Register(Application.SETDRAWISENABLED, Sub(DrawIsEnabled As Boolean) + Me.DrawIsEnabled = DrawIsEnabled + End Sub) End Sub