From b505b79d9aa2d4829f1f683071d540380bed1dbb Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Wed, 31 May 2023 12:27:08 +0200 Subject: [PATCH] Correzione gestione apertura CN per Tagli Diretti --- Simulation/SimulationPageUC.xaml.vb | 49 ++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/Simulation/SimulationPageUC.xaml.vb b/Simulation/SimulationPageUC.xaml.vb index 952f929..b8eea57 100644 --- a/Simulation/SimulationPageUC.xaml.vb +++ b/Simulation/SimulationPageUC.xaml.vb @@ -567,16 +567,55 @@ Public Class SimulationPageUC End Sub Private Sub GenerateXPIUC_Click(sender As Object, e As RoutedEventArgs) - ' eventualmente fermo la simulazione - m_nStatus = MCH_SIM_ST.UI_STOP - m_bPlay = False - PlayPauseBtn_Click(Nothing, Nothing) - ' se il bottone Shift รจ premuto apro il file CadCut1 nel programma NotePad Dim IsPressedShiftKey As Boolean = False If Keyboard.Modifiers And ModifierKeys.Shift Then IsPressedShiftKey = True End If + + ' Se nella pagina di tagli diretti + If m_MainWindow.DirectCutBtn.IsChecked And Not m_MainWindow.CadCutBtn.IsChecked Then + ' Genero file CNC (lancio anche se errore in precedenza) + Dim sCncPathDirect As String = m_MainWindow.GetCncDir() & "\DirectCut" & m_MainWindow.m_CurrentMachine.sIsoFileExt + Dim bOkDirect As Boolean = EgtGenerate(sCncPathDirect, "OmagCut ver." & m_MainWindow.GetVersion()) + + ' Costringo ad aggiornare UI + UpdateUI() + ' Ripristino come fase corrente quella iniziale + EgtSetCurrPhase(1) + If bOkDirect Then + m_CurrProjPage.SetInfoMessage("Genarato file " & "DirectCut" & m_MainWindow.m_CurrentMachine.sIsoFileExt) + Else + m_CurrProjPage.SetErrorMessage(EgtMsg(90314)) 'Errore nella generazione del programma CN + End If + ' procedo all'apertura del file CadCut1 apenna generato (solo se generazione corretta) + If bOkDirect And IsPressedShiftKey Then + Try + Process.Start("Notepad.exe", sCncPathDirect) + Catch ex As Exception + EgtOutLog(ex.ToString) + End Try + End If + ' ricarico la pagina di simulazione + EgtSetCurrPhase(1) + ' nascondo i pezzi in parcheggio + HideParkedParts(True) + ' Avvio ambiente di simulazione + EgtSimInit() + EgtSimStart() + ' Imposto stato corrente + SetStatus(MCH_SIM_ST.UI_STOP) + m_bPlay = True + ' Costringo ad aggiornare UI + UpdateUI() + ' esco + Return + End If + + ' eventualmente fermo la simulazione + m_nStatus = MCH_SIM_ST.UI_STOP + m_bPlay = False + PlayPauseBtn_Click(Nothing, Nothing) Dim bOk As Boolean = True EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx()) ' Elimino eventuale attrezzaggio da OmagOFFICE