diff --git a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb index 52d5948..65994d4 100644 --- a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb +++ b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb @@ -91,6 +91,27 @@ Public Class SimulationExpanderVM ' Verifico se richiesta anche visualizzazione del CN Dim bNcView As Boolean = ((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift) + ' Verifico se richiesto anche nome del CN + Dim bNcName As Boolean = ((Keyboard.Modifiers And ModifierKeys.Control) = ModifierKeys.Control) + If bNcName Then + Dim sExt As String = ".cnc" + EgtUILib.GetPrivateProfileString(S_PARTPROGRAM, K_EXTENSION, sExt, sExt, IniFile.m_sCurrMachIniFilePath) + Dim sCurrFilePath As String = "" + Dim sInitDir As String = "" + EgtGetCurrFilePath(sCurrFilePath) + If Not IsNothing(sCurrFilePath) Then sInitDir = System.IO.Path.ChangeExtension(sCurrFilePath, sExt) + Dim NewSaveFileDialog As New Windows.Forms.SaveFileDialog With {.Title = "PartProgram File Name", + .Filter = "|*" & sExt, + .FilterIndex = 1, + .InitialDirectory = System.IO.Path.GetDirectoryName(sInitDir), + .FileName = sInitDir, + .CreatePrompt = True, + .OverwritePrompt = True, + .ValidateNames = False} + If NewSaveFileDialog.ShowDialog() = Forms.DialogResult.Cancel Then Return + EgtSetInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_NCNAME, NewSaveFileDialog.FileName) + End If + ' Recupero la fase corrente Dim nPhase As Integer = EgtGetCurrPhase() ' Aggiorno le lavorazioni @@ -449,7 +470,10 @@ Public Class SimulationExpanderVM sInfo = "EgtCAM5 ver." & Map.refMainWindowVM.Version() & " - " & sCurrFilePath #End If If EgtGetInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_NCNAME, sCncFile) AndAlso Not String.IsNullOrWhiteSpace(sCncFile) Then - sCncFile = Path.GetDirectoryName(sCurrFilePath) & "\" & Path.GetFileName(sCncFile) + Dim sFileDir As String = Path.GetDirectoryName( sCncFile) + If String.IsNullOrWhiteSpace(sFileDir) OrElse Not My.Computer.FileSystem.DirectoryExists(sFileDir) Then + sCncFile = Path.GetDirectoryName(sCurrFilePath) & "\" & Path.GetFileName(sCncFile) + End If Else sCncFile = Path.ChangeExtension(sCurrFilePath, Nothing) If IniFile.m_bMachiningGroup Then @@ -459,7 +483,7 @@ Public Class SimulationExpanderVM sInfo &= "-" & sMGrpName End If End If - Dim sExt As String = ".cnc" + Dim sExt As String = ".cnc" EgtUILib.GetPrivateProfileString(S_PARTPROGRAM, K_EXTENSION, sExt, sExt, IniFile.m_sCurrMachIniFilePath) sCncFile = Path.ChangeExtension(sCncFile, sExt) End If