EgtCAM5 2.1j4 :

- aggiunta possibilità di visualizzare il partprogram generato (Shift+Genera).
This commit is contained in:
Dario Sassi
2019-10-08 18:24:42 +00:00
parent 63e86d965f
commit fa083039bf
2 changed files with 74 additions and 47 deletions
@@ -574,58 +574,46 @@ Public Class SimulationExpanderVM
''' Creata the new tool. This method is invoked by the NewCommand.
''' </summary>
Public Sub Generate(ByVal param As Object)
' 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
' Eseguo
Dim sCurrFilePath As String = String.Empty
EgtGetCurrFilePath(sCurrFilePath)
If String.IsNullOrEmpty(sCurrFilePath) OrElse EgtGetModified() Then
' Il progetto deve essere salvato prima di poter essere generato. Vuoi farlo ?
If MessageBox.Show(EgtMsg(MSG_SIMULATION + 31), EgtMsg(MSG_SIMULATION + 15), MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.No Then
' Abbandono
' 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
Else
' Lancio salvataggio
Application.Msn.NotifyColleagues(Application.SAVEPROJECT)
' Se non salvato, abbandono
If EgtGetModified() Then Return
' Aggiorno path
EgtGetCurrFilePath(sCurrFilePath)
End If
End If
Dim sCncFile As String = ""
Dim sInfo As String = "EgtCAM5 - " & sCurrFilePath
If EgtGetInfo( EgtGetCurrMachGroup(), KEY_MCHGRP_NCNAME, sCncFile) AndAlso Not String.IsNullOrWhiteSpace( sCncFile) then
sCncFile = Path.GetDirectoryName (sCurrFilePath) & "\" & sCncFile
else
sCncFile = Path.ChangeExtension(sCurrFilePath, Nothing)
If IniFile.m_bMachiningGroup Then
Dim sMGrpName As String = String.Empty
If EgtGetMachGroupName(EgtGetCurrMachGroup(), sMGrpName) Then
sCncFile &= "_" & sMGrpName & ".cnc"
sInfo &= "-" & sMGrpName
' 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
Else
sCncFile &= ".cnc"
End If
End if
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)
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)
' Altrimenti premuto shift, Visualizzo CN corrente
Else
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_SIMULATION + 32) & " (" & sCncFile & ")")
' Recupero nome file CN
Dim sCncFile As String = ""
Dim sInfo As String = ""
If Not GetCncFileName( False, sCncFile, sInfo) Then Return
' Se esiste ne lancio l'editing
If File.Exists( sCncFile) Then
Process.Start( "Notepad.exe", sCncFile)
' altrimenti lo segnalo
Else
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "Edit failed, missing part program file" & " (" & sCncFile & ")")
End If
End If
' Torno alla fase originale (o alla prima se non definita)
EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True)
End Sub
#End Region ' GenerateCommand
@@ -932,6 +920,45 @@ Public Class SimulationExpanderVM
End If
End Sub
Private Function GetCncFileName( bAskSave As Boolean, ByRef sCncFile As String, ByRef sInfo As String) As Boolean
' Recupero e verifico la path del progetto corrente
Dim sCurrFilePath As String = String.Empty
EgtGetCurrFilePath(sCurrFilePath)
If bAskSave Then
If String.IsNullOrEmpty(sCurrFilePath) OrElse EgtGetModified() Then
' Il progetto deve essere salvato prima di poter essere generato. Vuoi farlo ?
If MessageBox.Show(EgtMsg(MSG_SIMULATION + 31), EgtMsg(MSG_SIMULATION + 15), MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.No Then
' Abbandono
Return False
Else
' Lancio salvataggio
Application.Msn.NotifyColleagues(Application.SAVEPROJECT)
' Se non salvato, abbandono
If EgtGetModified() Then Return False
' Aggiorno path
EgtGetCurrFilePath(sCurrFilePath)
End If
End If
End If
sCncFile = ""
sInfo = "EgtCAM5 - " & sCurrFilePath
If EgtGetInfo( EgtGetCurrMachGroup(), KEY_MCHGRP_NCNAME, sCncFile) AndAlso Not String.IsNullOrWhiteSpace( sCncFile) then
sCncFile = Path.GetDirectoryName (sCurrFilePath) & "\" & sCncFile
else
sCncFile = Path.ChangeExtension(sCurrFilePath, Nothing)
If IniFile.m_bMachiningGroup Then
Dim sMGrpName As String = String.Empty
If EgtGetMachGroupName(EgtGetCurrMachGroup(), sMGrpName) Then
sCncFile &= "_" & sMGrpName & ".cnc"
sInfo &= "-" & sMGrpName
End If
Else
sCncFile &= ".cnc"
End If
End if
Return True
End Function
Private Function GetEstimationFileName(bAskSave As Boolean, ByRef sEstFile As String, ByRef sInfo As String) As Boolean
Dim bOk As Boolean = True
' Recupero e verifico la path del progetto corrente