From 18428e68ff4cfd2dd56e9da1f23e512691e015a9 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 20 Feb 2020 07:39:26 +0000 Subject: [PATCH] EgtCAM5 2.2b6 : - ora Shift+Genera esegue la generazione del CN e poi lo visualizza. --- My Project/AssemblyInfo.vb | 4 +- .../SimulationExpanderViewModel.vb | 57 +++++++++---------- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index afbedcd..0cd5422 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -70,5 +70,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb index fa37806..81436b8 100644 --- a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb +++ b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb @@ -574,38 +574,37 @@ Public Class SimulationExpanderVM ''' Creata the new tool. This method is invoked by the NewCommand. ''' Public Sub Generate(ByVal param As Object) - ' Normalmente, Genero - If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then - ' Recupero la fase corrente - Dim nPhase As Integer = EgtGetCurrPhase() - ' Aggiorno le lavorazioni - If Not UpdateAllMachinings() Then - EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True) - Return - End If - ' Recupero nome file CN (dopo aver verificato salvataggio progetto) - Dim sCncFile As String = "" - Dim sInfo As String = "" - If Not GetCncFileName( True, sCncFile, sInfo) Then Return - ' Eseguo - If Not EgtGenerate(sCncFile, sInfo) Then - If EgtGetLastMachMgrErrorId() <> 0 Then - Dim sErr As String = EgtGetLastMachMgrErrorString() - MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation) - Else - MessageBox.Show(EgtMsg(MSG_SIMULATION + 6), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error) - End If + + ' Verifico se richiesta anche visualizzazione del CN + Dim bNcView As Boolean = ( (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift) + + ' Recupero la fase corrente + Dim nPhase As Integer = EgtGetCurrPhase() + ' Aggiorno le lavorazioni + If Not UpdateAllMachinings() Then + EgtSetCurrPhase( If( nPhase = 0, 1, nPhase), True) + Return + End If + ' Recupero nome file CN (dopo aver verificato salvataggio progetto) + Dim sCncFile As String = "" + Dim sInfo As String = "" + If Not GetCncFileName( True, sCncFile, sInfo) Then Return + ' Eseguo + If Not EgtGenerate(sCncFile, sInfo) Then + If EgtGetLastMachMgrErrorId() <> 0 Then + Dim sErr As String = EgtGetLastMachMgrErrorString() + MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation) Else - Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_SIMULATION + 32) & " (" & sCncFile & ")") + MessageBox.Show(EgtMsg(MSG_SIMULATION + 6), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error) End If - ' Torno alla fase originale (o alla prima se non definita) - EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True) - ' Altrimenti premuto shift, Visualizzo CN corrente Else - ' Recupero nome file CN - Dim sCncFile As String = "" - Dim sInfo As String = "" - If Not GetCncFileName( False, sCncFile, sInfo) Then Return + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_SIMULATION + 32) & " (" & sCncFile & ")") + End If + ' Torno alla fase originale (o alla prima se non definita) + EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True) + + ' Se richiesta anche la visualizzazione del CN corrente, procedo + If bNcView Then ' Se esiste ne lancio l'editing If File.Exists( sCncFile) Then Process.Start( "Notepad.exe", sCncFile)