From e1f9b932ec83522364ecfed7655751b83f90104d Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Fri, 1 Jul 2016 05:37:52 +0000 Subject: [PATCH] TestEIn 1.6r11 : - migliorata gestione DDF. --- ConstIni.vb | 1 + Doors.vb | 35 +++++++++++++++++++++-------------- Form1.vb | 38 ++++++++++++++++++++++++++++++-------- My Project/AssemblyInfo.vb | 4 ++-- 4 files changed, 54 insertions(+), 24 deletions(-) diff --git a/ConstIni.vb b/ConstIni.vb index 11956df..0b014e8 100644 --- a/ConstIni.vb +++ b/ConstIni.vb @@ -87,6 +87,7 @@ Public Const S_DOORS As String = "Doors" Public Const K_DDFEXEC As String = "DdfExec" Public Const K_DDFFUNCTION As String = "DdfFun" Public Const K_DDFDIR As String = "DdfDir" +Public Const K_DDFDEFAULTDIR As String = "DdfDefaultDir" Public Const S_MACH As String = "Mach" Public Const K_MACHINESDIR As String = "MachinesDir" diff --git a/Doors.vb b/Doors.vb index cfe8f79..5c80ad4 100644 --- a/Doors.vb +++ b/Doors.vb @@ -36,20 +36,8 @@ Public Module Doors ' Generazione porta ' Cursore attesa scene.Cursor = Cursors.WaitCursor - ' Carico il file - Dim sExecPath As String = String.Empty - GetPrivateProfileString(S_DOORS, K_DDFEXEC, "", sExecPath, Form1.GetIniFile()) - If Not EgtLuaExecFile(sExecPath) Then Return False - ' Lancio la generazione - EgtLuaSetGlobStringVar("DGD.FILE", sFile) - Dim sFunction As String = String.Empty - GetPrivateProfileString(S_DOORS, K_DDFFUNCTION, "", sFunction, Form1.GetIniFile()) - Dim bOk As Boolean = EgtLuaExecLine(sFunction) - Dim nErr As Integer = 999 - If Not EgtLuaGetGlobIntVar("DGD.ERR", nErr) Or nErr <> 0 Then bOk = False - EgtOutLog("Err=" & nErr.ToString()) - ' Cancello variabile globale - EgtLuaResetGlobVar("DGD") + ' Creazione porta + Dim bOk As Boolean = CreateDoors(sFile, False) ' Aggiorno la visualizzazione EgtZoom(ZM.ALL) ' Cursore standard @@ -58,4 +46,23 @@ Public Module Doors Return bOk End Function + Function CreateDoors(ByRef sDdfFile As String, bNcGen As Boolean) As Boolean + ' Carico il file + Dim sExecPath As String = String.Empty + GetPrivateProfileString(S_DOORS, K_DDFEXEC, "", sExecPath, Form1.GetIniFile()) + If Not EgtLuaExecFile(sExecPath) Then Return False + ' Lancio la creazione + EgtLuaSetGlobStringVar("DGD.FILE", sDdfFile) + EgtLuaSetGlobBoolVar("DGD.NCGEN", bNcGen) + Dim sFunction As String = String.Empty + GetPrivateProfileString(S_DOORS, K_DDFFUNCTION, "", sFunction, Form1.GetIniFile()) + Dim bOk As Boolean = EgtLuaExecLine(sFunction) + Dim nErr As Integer = 999 + If Not EgtLuaGetGlobIntVar("DGD.ERR", nErr) Or nErr <> 0 Then bOk = False + EgtOutLog("Err=" & nErr.ToString()) + ' Cancello variabile globale + EgtLuaResetGlobVar("DGD") + Return bOk + End Function + End Module diff --git a/Form1.vb b/Form1.vb index 9b416e3..2c02e18 100644 --- a/Form1.vb +++ b/Form1.vb @@ -355,23 +355,45 @@ Public Class Form1 FormTimer.Stop() ' Recupero eventuali parametri da linea di comando Dim bOpen As Boolean = False - For Each s As String In My.Application.CommandLineArgs - If Not String.IsNullOrWhiteSpace(s) Then - Dim nFileType As Integer = EgtGetFileType(s) + If My.Application.CommandLineArgs.Count() > 0 Then + Dim sFile As String = My.Application.CommandLineArgs(0) + If Not String.IsNullOrWhiteSpace(sFile) Then + Dim nFileType As Integer = EgtGetFileType(sFile) Select Case nFileType Case FT.NGE, FT.NFE - m_Controller.OpenProject(s, False) + m_Controller.OpenProject(sFile, False) bOpen = True Case FT.DXF, FT.STL, FT.CNC, FT.CSF, FT.BTL - m_Controller.ImportProject(s, False) + m_Controller.ImportProject(sFile, False) bOpen = True Case FT.TSC, FT.LUA - m_Controller.Exec(s, False) + m_Controller.Exec(sFile, False) bOpen = True End Select - Exit For + 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, m_sIniFile) + sFile = sDefDir & "\" & sFile + End If + ' Ricoscimento flag + Dim nPar2 As Integer = 0 + If My.Application.CommandLineArgs.Count() > 1 Then + nPar2 = CInt(My.Application.CommandLineArgs(1)) + End If + Dim bNcGen As Boolean = (nPar2 >= 1) + ' Esecuzione + CreateDoors(sFile, bNcGen) + EgtZoom(ZM.ALL) + ' Se richiesta uscita immediata + Dim bExit As Boolean = (nPar2 >= 2) + If bExit Then + Close() + End If + End If End If - Next + End If End Sub Private Sub Form1_DragEnter(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles Me.DragEnter diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 8b2ee01..700fbd7 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -46,5 +46,5 @@ Imports System.Runtime.InteropServices ' utilizzando l'asterisco (*) come descritto di seguito: ' - - + +