22c13fad6e
- aggiunta gestione GunStock - correzione gestione utensili per calcolo automatico.
91 lines
3.4 KiB
VB.net
91 lines
3.4 KiB
VB.net
'----------------------------------------------------------------------------
|
|
' EgalTech 2016-2016
|
|
'----------------------------------------------------------------------------
|
|
' File : Doors.vb Data : 22.06.16 Versione : 1.6r10
|
|
' Contenuto : Classe Doors (interfaccia per script Porte).
|
|
'
|
|
'
|
|
'
|
|
' Modifiche : 22.06.16 DS Creazione modulo.
|
|
'
|
|
'
|
|
'----------------------------------------------------------------------------
|
|
|
|
Imports Microsoft.VisualBasic
|
|
Imports EgtUILib
|
|
|
|
Public Module Doors
|
|
|
|
Function ExecDoors(ByRef scene As Scene, sFilePath As String) As Boolean
|
|
' Scelta file DDF
|
|
Dim sFile As String
|
|
' Se sFilePath non vuoto apro questo file
|
|
If Not String.IsNullOrEmpty(sFilePath) Then
|
|
sFile = sFilePath
|
|
Else
|
|
' Direttorio corrente per file DDF
|
|
Dim sDir As String = String.Empty
|
|
GetPrivateProfileString(S_DOORS, K_DDFDIR, "", sDir)
|
|
' Apertura dialogo di scelta file DDF
|
|
Dim OpenFileDialog As New System.Windows.Forms.OpenFileDialog
|
|
OpenFileDialog.Title = "Open DDF file"
|
|
OpenFileDialog.Filter = "Door Description Format(*.ddf)|*.ddf"
|
|
OpenFileDialog.FilterIndex = 1
|
|
OpenFileDialog.InitialDirectory = sDir
|
|
If OpenFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then
|
|
Return True
|
|
End If
|
|
sFile = OpenFileDialog.FileName
|
|
End If
|
|
System.IO.Path.GetDirectoryName(sFile)
|
|
WritePrivateProfileString(S_DOORS, K_DDFDIR, System.IO.Path.GetDirectoryName(sFile))
|
|
|
|
' Generazione porta
|
|
' Cursore attesa
|
|
scene.Cursor = System.Windows.Forms.Cursors.WaitCursor
|
|
' Creazione porta
|
|
Dim bOk As Boolean = CreateDoors(sFile, False, False)
|
|
' Scrivo il nome del file aperto in una variabile globale per averlo in caso di errore
|
|
IniFile.m_DDFFilePath = sFile
|
|
' Aggiorno la visualizzazione
|
|
EgtZoom(ZM.ALL)
|
|
' Cursore standard
|
|
scene.Cursor = System.Windows.Forms.Cursors.Default
|
|
|
|
Return bOk
|
|
End Function
|
|
|
|
Function CreateDoors(ByRef sDdfFile As String, bNcGen As Boolean, bBatch As Boolean) As Boolean
|
|
' Carico il file
|
|
Dim sExecPath As String = String.Empty
|
|
GetPrivateProfileString(S_DOORS, K_DDFEXEC, "", sExecPath)
|
|
If Not EgtLuaExecFile(sExecPath) Then Return False
|
|
' Lancio la creazione
|
|
EgtLuaSetGlobStringVar("DGD.FILE", sDdfFile)
|
|
EgtLuaSetGlobBoolVar("DGD.NCGEN", bNcGen)
|
|
EgtLuaSetGlobBoolVar("DGD.BATCH", bBatch)
|
|
Dim sFunction As String = String.Empty
|
|
GetPrivateProfileString(S_DOORS, K_DDFFUNCTION, "", sFunction)
|
|
Dim bOk As Boolean = EgtLuaExecLine(sFunction)
|
|
Dim nErr As Integer = 999
|
|
If Not EgtLuaGetGlobIntVar("DGD.ERR", nErr) Or nErr <> 0 Then bOk = False
|
|
EgtOutLog("Doors Err=" & nErr.ToString())
|
|
' Cancello variabile globale
|
|
EgtLuaResetGlobVar("DGD")
|
|
Return bOk
|
|
End Function
|
|
|
|
Function ExecDoorsMachining(ByRef scene As Scene) As Boolean
|
|
' Cursore attesa
|
|
scene.Cursor = System.Windows.Forms.Cursors.WaitCursor
|
|
' Carico ed eseguo il file
|
|
Dim sExecPath As String = String.Empty
|
|
GetPrivateProfileString(S_DOORS, K_DDFMACHEXEC, "", sExecPath)
|
|
Dim bOk As Boolean = EgtLuaExecFile(sExecPath)
|
|
' Cursore standard
|
|
scene.Cursor = System.Windows.Forms.Cursors.Default
|
|
Return bOk
|
|
End Function
|
|
|
|
End Module
|