EgtCAM5 :

- aggiunte per gestione DB utensili da file tol su linea di comando.
This commit is contained in:
Dario Sassi
2017-12-02 18:42:07 +00:00
parent c0a15eff17
commit ecb9d7caf6
5 changed files with 294 additions and 48 deletions
+51 -41
View File
@@ -250,7 +250,7 @@ Namespace EgtCAM5
If Not m_Controller.SetCommandLog(bLuaReg, m_sTempDir, sCmdLogFile) Then
EgtOutLog("Command log not started")
If Environment.GetCommandLineArgs.Count() <= 1 Then
MessageBox.Show("Command log not started", "TestEIn Warning",
MessageBox.Show("Command log not started", "EgtCAM5 Warning",
MessageBoxButton.OK, MessageBoxImage.Warning)
End If
End If
@@ -300,48 +300,58 @@ Namespace EgtCAM5
End Sub
Private Sub ProcessCommandLine()
' Recupero eventuali parametri da linea di comando
Dim bOpen As Boolean = False
If Environment.GetCommandLineArgs.Count() > 1 Then
Dim sFile As String = Environment.GetCommandLineArgs(1)
If Not String.IsNullOrWhiteSpace(sFile) Then
Dim nFileType As Integer = EgtGetFileType(sFile)
Select Case nFileType
Case FT.NGE, FT.NFE
m_Controller.OpenProject(sFile, False)
bOpen = True
Case FT.DXF, FT.STL, FT.CNC, FT.CSF, FT.BTL
m_Controller.ImportProject(sFile, False)
bOpen = True
Case FT.TSC, FT.LUA
m_Controller.Exec(sFile, False)
bOpen = True
End Select
If IO.Path.GetExtension(sFile).ToLower() = ".ddf" Then
' Se manca direttorio uso quello di default
If String.IsNullOrWhiteSpace(IO.Path.GetDirectoryName(sFile)) Then
Dim sDefDir As String = String.Empty
GetPrivateProfileString(S_DOORS, K_DDFDEFAULTDIR, "", sDefDir)
sFile = sDefDir & "\" & sFile
End If
' Ricoscimento flag
Dim nPar2 As Integer = 0
If Environment.GetCommandLineArgs.Count() > 2 Then
nPar2 = CInt(Environment.GetCommandLineArgs(2))
End If
Dim bNcGen As Boolean = (nPar2 >= 1)
Dim bExit As Boolean = (nPar2 >= 2)
' Esecuzione
CreateDoors(sFile, bNcGen, bExit)
EgtZoom(ZM.ALL)
Application.Msn.NotifyColleagues(Application.EMITTITLE)
' Se richiesta uscita immediata
If bExit Then
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND)
End If
End If
' Se non ci sono parametri su linea di comando, esco
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 ddf, gestione creazione porta con Doors
If sExt = ".ddf" Then
' Se manca direttorio uso quello di default
If String.IsNullOrWhiteSpace(IO.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 Int32.TryParse(Environment.GetCommandLineArgs(2), nFlag)
Dim bNcGen As Boolean = (nFlag >= 1)
Dim bExit As Boolean = (nFlag >= 2)
' Esecuzione
CreateDoors(sFile, bNcGen, bExit)
EgtZoom(ZM.ALL)
Application.Msn.NotifyColleagues(Application.EMITTITLE)
' Se richiesta uscita immediata
If bExit Then Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND)
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 Int32.TryParse(Environment.GetCommandLineArgs(3), nFlag)
Dim bTest As Boolean = (nFlag = 0)
' Esecuzione
UpdateTools(sFile, sMachine, bTest)
' Uscita immediata
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND)
Return
End If
' Altrimenti gestione file standard
Dim nFileType As Integer = EgtGetFileType(sFile)
Select Case nFileType
Case FT.NGE, FT.NFE
m_Controller.OpenProject(sFile, False)
Case FT.DXF, FT.STL, FT.CNC, FT.CSF, FT.BTL
m_Controller.ImportProject(sFile, False)
Case FT.TSC, FT.LUA
m_Controller.Exec(sFile, False)
End Select
End Sub
Private Sub EmitTitle()