From 68fecfb24e53cb31b310f80f2c7982fef32bbee1 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 22 Dec 2020 14:34:06 +0000 Subject: [PATCH] EgtCAM5 : - modifiche per interfaccia con EgtBeamWall. --- MainWindow/MainWindowV.xaml.vb | 8 +- Project/ProjectVM.vb | 309 ++++++++++++++++++--------------- 2 files changed, 178 insertions(+), 139 deletions(-) diff --git a/MainWindow/MainWindowV.xaml.vb b/MainWindow/MainWindowV.xaml.vb index d2c64a2..c82114f 100644 --- a/MainWindow/MainWindowV.xaml.vb +++ b/MainWindow/MainWindowV.xaml.vb @@ -4,10 +4,16 @@ Imports EgtWPFLib5 Class MainWindowV Inherits EgtCustomWindow + Private Sub Me_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized + If Not ProjectVM.GetAppToShow() Then + Me.ShowInTaskbar = False + End If + End Sub + Private Sub EgtCustomWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded ' Posizione e dimensioni del Form Dim WinPos As New WinPos - If Map.refProjectVM.GetAppToShow() Then + If ProjectVM.GetAppToShow() Then GetPrivateProfileWinPos(S_GENERAL, K_WINPLACE, WinPos.nFlag, WinPos.nLeft, WinPos.nTop, WinPos.nWidth, WinPos.nHeight) Else GetPrivateProfileWinPos(S_GENERAL, K_HIDEPLACE, WinPos.nFlag, WinPos.nLeft, WinPos.nTop, WinPos.nWidth, WinPos.nHeight) diff --git a/Project/ProjectVM.vb b/Project/ProjectVM.vb index 23ad7f7..4daf724 100644 --- a/Project/ProjectVM.vb +++ b/Project/ProjectVM.vb @@ -302,152 +302,184 @@ Public Class ProjectVM m_Controller.SetDefaultForImageExport(OptionModule.m_nImgWidth, OptionModule.m_nImgHeight) End Sub - Friend Function GetAppToShow() As Boolean - ' Se non ci sono veri parametri su linea di comando, visualizzazione standard - If Environment.GetCommandLineArgs.Count() <= 1 Then Return True - ' Recupero il primo vero parametro che dovrebbe essere il nome con estensione di un file - Dim sFile As String = Environment.GetCommandLineArgs(1) - Dim sExt As String = Path.GetExtension(sFile).ToLower() - ' Analizzo i parametri - If sExt = ".btl" And Environment.GetCommandLineArgs.Count() > 2 Then - ' Flag - Dim nFlag As Integer = 1 - If Environment.GetCommandLineArgs.Count() > 3 Then Integer.TryParse(Environment.GetCommandLineArgs(3), nFlag) - ' Modalità cieco con valori 0, 3 e 4 - Return (nFlag <> 0 And nFlag <> 3 And nFlag <> 4) - End If - Return True - End Function - Friend Sub ProcessCommandLine() - ' Se non ci sono veri parametri su linea di comando, esco (il primo è sempre il nome del programma) - If Environment.GetCommandLineArgs.Count() <= 1 Then Return - ' Recupero il primo vero parametro che dovrebbe essere il nome con estensione di un file - Dim sFile As String = Environment.GetCommandLineArgs(1) - Dim sExt As String = Path.GetExtension(sFile).ToLower() - If String.IsNullOrWhiteSpace(sFile) OrElse String.IsNullOrWhiteSpace(sExt) Then Return - ' Se file btl con opzioni, gestione lavorazione travi - If sExt = ".btl" And Environment.GetCommandLineArgs.Count() > 2 Then - ' Nome macchina - Dim sMachine As String = "" - If Environment.GetCommandLineArgs.Count() > 2 Then sMachine = Environment.GetCommandLineArgs(2) - ' Flag - Dim nFlag As Integer = 1 - If Environment.GetCommandLineArgs.Count() > 3 Then Integer.TryParse(Environment.GetCommandLineArgs(3), nFlag) - Dim bOk As Boolean = False - ' Verifico se travi o pareti (dal nome della macchina) - Dim sBeamMachines As String = "" - GetPrivateProfileString(S_BEAM, K_BEAMMACHINES, "", sBeamMachines) - Dim vsBMachs() As String = sBeamMachines.Split(","c).ToArray - Dim bBeam As Boolean = False - For Each sBMach In vsBMachs - If Not String.IsNullOrWhiteSpace(sBMach) AndAlso sMachine.StartsWith(sBMach, True, CultureInfo.InvariantCulture) Then - bBeam = True - Exit For - End If - Next - ' Se Travi - If bBeam Then - ' Verifica abilitazione elaborazione travi - If Not VerifyBeam(sFile, sMachine, nFlag) Then - Map.refMainWindowVM.CloseApplicationCmd() - Return - End If - ' Esecuzione - bOk = ExecBeam(sFile, sMachine, nFlag) - ' altrimenti pareti - Else - ' Verifica abilitazione elaborazione pareti - If Not VerifyWall(sFile, sMachine, nFlag) Then - Map.refMainWindowVM.CloseApplicationCmd() - Return - End If - ' Esecuzione - bOk = ExecWall(sFile, sMachine, nFlag) + Friend Shared Function GetAppToShow() As Boolean + ' Se non ci sono veri parametri su linea di comando, visualizzazione standard + If Environment.GetCommandLineArgs.Count() <= 1 Then Return True + ' Recupero il primo vero parametro che dovrebbe essere il nome con estensione di un file + Dim sFile As String = Environment.GetCommandLineArgs(1) + Dim sExt As String = Path.GetExtension(sFile).ToLower() + ' Analizzo i parametri + If (sExt = ".btl" Or sExt = ".bwe") And Environment.GetCommandLineArgs.Count() > 2 Then + ' Flag + Dim nFlag As Integer = 1 + If Environment.GetCommandLineArgs.Count() > 3 Then Integer.TryParse(Environment.GetCommandLineArgs(3), nFlag) + ' Modalità cieco con valori 0, 3 e 4 + Return (nFlag <> 0 And nFlag <> 3 And nFlag <> 4) + End If + Return True + End Function + + Friend Sub ProcessCommandLine() + ' Se non ci sono veri parametri su linea di comando, esco (il primo è sempre il nome del programma) + If Environment.GetCommandLineArgs.Count() <= 1 Then Return + ' Recupero il primo vero parametro che dovrebbe essere il nome con estensione di un file + Dim sFile As String = Environment.GetCommandLineArgs(1) + Dim sExt As String = Path.GetExtension(sFile).ToLower() + If String.IsNullOrWhiteSpace(sFile) OrElse String.IsNullOrWhiteSpace(sExt) Then Return + ' Se file btl con opzioni, gestione lavorazione travi + If sExt = ".btl" And Environment.GetCommandLineArgs.Count() > 2 Then + ' Nome macchina + Dim sMachine As String = "" + If Environment.GetCommandLineArgs.Count() > 2 Then sMachine = Environment.GetCommandLineArgs(2) + ' Flag + Dim nFlag As Integer = 1 + If Environment.GetCommandLineArgs.Count() > 3 Then Integer.TryParse(Environment.GetCommandLineArgs(3), nFlag) + Dim bOk As Boolean = False + ' Verifico se travi o pareti (dal nome della macchina) + Dim sBeamMachines As String = "" + GetPrivateProfileString(S_BEAM, K_BEAMMACHINES, "", sBeamMachines) + Dim vsBMachs() As String = sBeamMachines.Split(","c).ToArray + Dim bBeam As Boolean = False + For Each sBMach In vsBMachs + If Not String.IsNullOrWhiteSpace(sBMach) AndAlso sMachine.StartsWith(sBMach, True, CultureInfo.InvariantCulture) Then + bBeam = True + Exit For End If - ' Se richiesta uscita immediata - If nFlag = 0 Or nFlag = 3 Or nFlag = 4 Then - Map.refMachinePanelVM.SaveCurrentMachine() - Map.refMainWindowVM.CloseApplicationCmd() - ' Altrimenti se richiesta visualizzazione DB utensili - ElseIf nFlag = 11 And bOk Then - MyMachinePanelVM.ToolDb() - Map.refMachinePanelVM.SaveCurrentMachine() - Map.refMainWindowVM.CloseApplicationCmd() - ' Altrimenti se richiesta visualizzazione DB lavorazioni - ElseIf nFlag = 12 And bOk Then - MyMachinePanelVM.MachDb() - If bBeam Then - Beam.BeamMachDb() - Else - Wall.WallMachDb() - End If - Map.refMachinePanelVM.SaveCurrentMachine() - Map.refMainWindowVM.CloseApplicationCmd() - ' Altrimenti se errore - ElseIf Not bOk Then - EgtZoom(ZM.ALL) + Next + ' Se Travi + If bBeam Then + ' Verifica abilitazione elaborazione travi + If Not VerifyBeam(sFile, sMachine, nFlag) Then + Map.refMainWindowVM.CloseApplicationCmd() + Return End If - ' Altrimenti si prosegue nel programma - Return - End If - ' Se file ddf, gestione creazione porta con Doors - If sExt = ".ddf" Then - ' Se manca direttorio uso quello di default - If String.IsNullOrWhiteSpace(Path.GetDirectoryName(sFile)) Then - Dim sDefDir As String = String.Empty - GetPrivateProfileString(S_DOORS, K_DDFDEFAULTDIR, "", sDefDir) - sFile = sDefDir & "\" & sFile - End If - ' Ricoscimento flag - Dim nFlag As Integer = 0 - If Environment.GetCommandLineArgs.Count() > 2 Then Integer.TryParse(Environment.GetCommandLineArgs(2), nFlag) - Dim bNcGen As Boolean = (nFlag >= 1) - Dim bExit As Boolean = (nFlag >= 2) - Dim nProbing As Integer = If(nFlag > 2, nFlag - 2, 0) - Dim bOk As Boolean = True ' Esecuzione - bOk = OpenDoorFile(sFile, bNcGen, bExit, nProbing) - ' Se richiesta uscita immediata - If bExit Then - Map.refMainWindowVM.CloseApplicationCmd() - Else - If EgtGetCurrMachGroup() <> GDB_ID.NULL Then - Map.refTopCommandBarVM.SetMachiningMode() - End If - If Not bOk Then Map.refStatusBarVM.NotifyStatusOutput(EgtMsg(MSG_DOORSERRORS + 2)) + bOk = ExecBeam(sFile, sMachine, nFlag) + ' altrimenti pareti + Else + ' Verifica abilitazione elaborazione pareti + If Not VerifyWall(sFile, sMachine, nFlag) Then + Map.refMainWindowVM.CloseApplicationCmd() + Return End If - Return - End If - ' Se file tol, gestione aggiornamento dei dati degli utensili - If sExt = ".tol" Then - ' Recupero nome macchina - Dim sMachine As String = String.Empty - If Environment.GetCommandLineArgs.Count() > 2 Then sMachine = Environment.GetCommandLineArgs(2) - ' Recupero flag - Dim nFlag As Integer = 0 - If Environment.GetCommandLineArgs.Count() > 3 Then Integer.TryParse(Environment.GetCommandLineArgs(3), nFlag) - Dim bTest As Boolean = (nFlag = 0) ' Esecuzione - UpdateTools(sFile, sMachine, bTest) - ' Uscita immediata + bOk = ExecWall(sFile, sMachine, nFlag) + End If + ' Se richiesta uscita immediata + If nFlag = 0 Or nFlag = 3 Or nFlag = 4 Then + Map.refMachinePanelVM.SaveCurrentMachine() Map.refMainWindowVM.CloseApplicationCmd() - Return - End If - ' Altrimenti gestione file standard - OpenStdFile(sFile) - End Sub + ' Altrimenti se richiesta visualizzazione DB utensili + ElseIf nFlag = 11 And bOk Then + MyMachinePanelVM.ToolDb() + Map.refMachinePanelVM.SaveCurrentMachine() + Map.refMainWindowVM.CloseApplicationCmd() + ' Altrimenti se richiesta visualizzazione DB lavorazioni + ElseIf nFlag = 12 And bOk Then + MyMachinePanelVM.MachDb() + If bBeam Then + Beam.BeamMachDb() + Else + Wall.WallMachDb() + End If + Map.refMachinePanelVM.SaveCurrentMachine() + Map.refMainWindowVM.CloseApplicationCmd() + ' Altrimenti se errore + ElseIf Not bOk Then + EgtZoom(ZM.ALL) + End If + ' Altrimenti si prosegue nel programma + Return + End If + ' Se file ddf, gestione creazione porta con Doors + If sExt = ".ddf" Then + ' Se manca direttorio uso quello di default + If String.IsNullOrWhiteSpace(Path.GetDirectoryName(sFile)) Then + Dim sDefDir As String = String.Empty + GetPrivateProfileString(S_DOORS, K_DDFDEFAULTDIR, "", sDefDir) + sFile = sDefDir & "\" & sFile + End If + ' Ricoscimento flag + Dim nFlag As Integer = 0 + If Environment.GetCommandLineArgs.Count() > 2 Then Integer.TryParse(Environment.GetCommandLineArgs(2), nFlag) + Dim bNcGen As Boolean = (nFlag >= 1) + Dim bExit As Boolean = (nFlag >= 2) + Dim nProbing As Integer = If(nFlag > 2, nFlag - 2, 0) + ' Esecuzione + OpenDoorFile(sFile, bNcGen, bExit, nProbing) + ' Se richiesta uscita immediata + If bExit Then Map.refMainWindowVM.CloseApplicationCmd() + Return + End If + ' Se file tol, gestione aggiornamento dei dati degli utensili + If sExt = ".tol" Then + ' Recupero nome macchina + Dim sMachine As String = String.Empty + If Environment.GetCommandLineArgs.Count() > 2 Then sMachine = Environment.GetCommandLineArgs(2) + ' Recupero flag + Dim nFlag As Integer = 0 + If Environment.GetCommandLineArgs.Count() > 3 Then Integer.TryParse(Environment.GetCommandLineArgs(3), nFlag) + Dim bTest As Boolean = (nFlag = 0) + ' Esecuzione + UpdateTools(sFile, sMachine, bTest) + ' Uscita immediata + Map.refMainWindowVM.CloseApplicationCmd() + Return + End If + ' Se file bwe, gestione file da calcolare per Beam&Wall + If sExt = ".bwe" Then + ' recupero tipo di progetto : 1 = travi, 2 = pareti, 3 = sandwich + Dim nBWType As Integer = 0 + If Environment.GetCommandLineArgs.Count() > 2 Then Integer.TryParse(Environment.GetCommandLineArgs(2), nBWType) + ' recupero nome macchina + Dim sMachine As String = "" + If Environment.GetCommandLineArgs.Count() > 3 Then sMachine = Environment.GetCommandLineArgs(3) + '' Flag + Dim nFlag As Integer = 0 + If Environment.GetCommandLineArgs.Count() > 4 Then Integer.TryParse(Environment.GetCommandLineArgs(4), nFlag) + Dim bOk As Boolean = False + If nBWType = 1 Then + ' Verifica abilitazione elaborazione travi + If Not VerifyBeam(sFile, sMachine, nFlag) Then + Map.refMainWindowVM.CloseApplicationCmd() + Return + End If + ' Esecuzione + bOk = ExecBeam(sFile, sMachine, nFlag) + ' altrimenti pareti + ElseIf nBWType = 2 Then + ' Verifica abilitazione elaborazione pareti + If Not VerifyWall(sFile, sMachine, nFlag) Then + Map.refMainWindowVM.CloseApplicationCmd() + Return + End If + ' Esecuzione + bOk = ExecWall(sFile, sMachine, nFlag) + End If + ' Se richiesta uscita immediata + If nFlag = 0 Or nFlag = 3 Or nFlag = 4 Then + Map.refMachinePanelVM.SaveCurrentMachine() + Map.refMainWindowVM.CloseApplicationCmd() + ' Altrimenti se richiesta visualizzazione DB utensili + ElseIf Not bOk Then + EgtZoom(ZM.ALL) + End If + End If + ' Altrimenti gestione file standard + OpenStdFile(sFile) + End Sub - Friend Function OpenStdFile(sFile As String) As Boolean - Dim nFileType As Integer = EgtGetFileType(sFile) - Select Case nFileType - Case FT.NGE, FT.NFE - Return m_Controller.OpenProject(sFile, False) - Case FT.DXF, FT.STL, FT.CNC, FT.CSF, FT.BTL, FT.IMG, FT.PNT, FT.IGES, FT.STEP_, FT.ACIS, FT.PARASOLID, FT.JT, FT.VRML, FT.C3D - Return m_Controller.ImportProject(sFile, False) - Case FT.TSC, FT.LUA - Return m_Controller.Exec(sFile, False) - End Select + Friend Function OpenStdFile(sFile As String) As Boolean + Dim nFileType As Integer = EgtGetFileType(sFile) + Select Case nFileType + Case FT.NGE, FT.NFE + Return m_Controller.OpenProject(sFile, False) + Case FT.DXF, FT.STL, FT.CNC, FT.CSF, FT.BTL, FT.IMG, FT.PNT, FT.IGES, FT.STEP_, FT.ACIS, FT.PARASOLID, FT.JT, FT.VRML, FT.C3D + Return m_Controller.ImportProject(sFile, False) + Case FT.TSC, FT.LUA + Return m_Controller.Exec(sFile, False) + End Select Return False End Function @@ -1016,6 +1048,7 @@ Public Class ProjectVM vtMove.z = 0 ' Muovo gli oggetti selezionati se consentito DispositionUtility.MoveRawPartPartAndFixture(nMoveId, vtMove, m_SelType, ptCurr) + EgtSaveFile("c:\Temp\ProveMovimentoVentose\Prova1.nge", NGE.BIN) EgtDraw() ' Aggiorno il punto precedente m_ptPrev = ptCurr