EgtCAM5 :

- altra modifica a scelta diretta path partprogram (ora la scelta non viene salvata).
This commit is contained in:
Dario Sassi
2026-06-09 15:28:45 +02:00
parent 0847ab0cd3
commit 4bb7052d50
@@ -93,41 +93,39 @@ Public Class SimulationExpanderVM
' 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
Dim sNcFilePath As String = NewSaveFileDialog.FileName
If sNcFilePath.StartsWith( Path.GetDirectoryName( sCurrFilePath)) Then
EgtSetInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_NCNAME, Path.GetFileName( sNcFilePath))
Else
EgtSetInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_NCNAME, sNcFilePath)
End If
End If
' Recupero la fase corrente
Dim nPhase As Integer = EgtGetCurrPhase()
Dim nPhase As Integer = Math.Max( EgtGetCurrPhase(), 1)
' Aggiorno le lavorazioni
If Not UpdateAllMachinings() Then
EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True)
EgtSetCurrPhase(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
If Not GetCncFileName(True, sCncFile, sInfo) Then
EgtSetCurrPhase(nPhase, True)
Return
End If
' Se richiesta scelta del nome file
If bNcName Then
Dim sExt As String = Path.GetExtension( sCncFile)
Dim NewSaveFileDialog As New Windows.Forms.SaveFileDialog With {.Title = "PartProgram File Name",
.Filter = "|*" & sExt,
.FilterIndex = 1,
.InitialDirectory = System.IO.Path.GetDirectoryName(sCncFile),
.FileName = sCncFile,
.CreatePrompt = True,
.OverwritePrompt = True,
.ValidateNames = False}
If NewSaveFileDialog.ShowDialog() = Forms.DialogResult.Ok Then
sCncFile = NewSaveFileDialog.FileName
End If
End If
' Eseguo
If Not EgtGenerate(sCncFile, sInfo) Then
Dim nErr As Integer = EgtGetLastMachMgrErrorId()
@@ -146,7 +144,7 @@ Public Class SimulationExpanderVM
Map.refStatusBarVM.NotifyStatusOutput(EgtMsg(5332) & " (" & sCncFile & ")")
End If
' Torno alla fase originale (o alla prima se non definita)
EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True)
EgtSetCurrPhase(nPhase, True)
' Se richiesta anche la visualizzazione del CN corrente, procedo
If bNcView Then
@@ -475,10 +473,7 @@ 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
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
sCncFile = Path.GetDirectoryName(sCurrFilePath) & "\" & Path.GetFileName(sCncFile)
Else
sCncFile = Path.ChangeExtension(sCurrFilePath, Nothing)
If IniFile.m_bMachiningGroup Then