f3eb475348
- aggiunta visualizzazione Estensioni caricate (Beam, Wall, Doors, Gunstock) con versione e direttorio di installazione.
87 lines
3.7 KiB
VB.net
87 lines
3.7 KiB
VB.net
Imports System.IO
|
|
Imports System.Globalization
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Module Beam
|
|
|
|
Friend Function VerifyBeam(sFile As String, sMachine As String, nFlag As Integer) As Boolean
|
|
' Se abilitato, esco con successo
|
|
If IsActiveBeam() Then Return True
|
|
' Segnalo il problema
|
|
Dim sErr As String = "Beam processing not enabled by licence"
|
|
EgtOutLog(sErr)
|
|
Try
|
|
File.WriteAllText(Path.ChangeExtension(sFile, ".txt"), "ERR=1" & vbNewLine & sErr & vbNewLine)
|
|
Catch
|
|
End Try
|
|
Return False
|
|
End Function
|
|
|
|
Friend Function ExecBeam(sFile As String, sMachine As String, nFlag As Integer, bBtl As Boolean) As Boolean
|
|
EgtOutLog("-- Start ExecBeam --")
|
|
' Recupero lo script da eseguire
|
|
Dim sExecName As String = ""
|
|
GetPrivateProfileString(S_BEAM, If(bBtl, K_BEAMBTLEXEC, K_BEAMBWEEXEC), "", sExecName)
|
|
Dim sExecPath As String = (IniFile.m_sBeamDirPath & "\" & sExecName).TrimEnd({"\"c})
|
|
If Not My.Computer.FileSystem.FileExists(sExecPath) Then
|
|
EgtOutLog("Not found BeamExec script " & sExecPath)
|
|
Return False
|
|
End If
|
|
' Preparo interfaccia per aggiornamento
|
|
Map.refManageLayerExpanderVM.ClearObjTree()
|
|
' Assegno i dati
|
|
EgtLuaCreateGlobTable("BEAM")
|
|
EgtLuaSetGlobStringVar("BEAM.BASEDIR", IniFile.m_sBeamDirPath)
|
|
EgtLuaSetGlobStringVar("BEAM.FILE", sFile)
|
|
EgtLuaSetGlobStringVar("BEAM.MACHINE", sMachine)
|
|
EgtLuaSetGlobIntVar("BEAM.FLAG", nFlag)
|
|
' variabile che comunica al lua che e' stato avviato da interfaccia BEAMWALL (per gestione messaggi errore lua)
|
|
If Not bBtl Then EgtLuaSetGlobBoolVar("BEAM.BW", True)
|
|
' Eseguo lo script
|
|
Dim bOk As Boolean = False
|
|
If EgtLuaExecFile(sExecPath) Then
|
|
' Recupero i risultati
|
|
Dim nErr As Integer = 999
|
|
EgtLuaGetGlobIntVar("BEAM.ERR", nErr)
|
|
bOk = (nErr <= 0)
|
|
If Not bOk Then EgtOutLog("BeamExec Err=" & nErr.ToString())
|
|
Else
|
|
EgtOutLog("Error executing Beam Exec script " & sExecPath)
|
|
Return False
|
|
End If
|
|
' Cancello tavola globale
|
|
EgtLuaResetGlobVar("BEAM")
|
|
' Aggiorno interfaccia
|
|
Map.refProjectVM.UpdateProjectUI(True)
|
|
Map.refManageLayerExpanderVM.SelectIdInObjTreeNoMark(EgtGetCurrLayer())
|
|
If EgtGetCurrMachGroup() <> GDB_ID.NULL Then
|
|
Map.refTopCommandBarVM.SetMachiningMode()
|
|
If bOk And nFlag = 2 Then
|
|
Map.refSimulationExpanderVM.Simulation_IsExpanded = True
|
|
End If
|
|
End If
|
|
Return bOk
|
|
End Function
|
|
|
|
Friend Function BeamMachDb() As Boolean
|
|
' Assegno le path
|
|
Dim sBaseDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\" & "Beam"
|
|
' verifico se ci sono i file ini
|
|
Dim sMachTypePath As String = sBaseDir & "\MachiningTypes.ini"
|
|
Dim sTabTemplPath As String = sBaseDir & "\BeamTableTemplate.ini"
|
|
If File.Exists(sMachTypePath) AndAlso File.Exists(sTabTemplPath) Then
|
|
' apro finestra di gestione lavorazioni travi
|
|
Dim sTitle = EgtMsg(9000) 'Tabelle delle lavorazioni delle travi
|
|
Dim BeamMchsWinVM As New BeamMachiningsWindowVM(sTitle, sBaseDir, sMachTypePath, sTabTemplPath)
|
|
Dim BeamMchsWinV As New BeamMachiningsWindowV(Application.Current.MainWindow, BeamMchsWinVM)
|
|
BeamMchsWinV.ShowDialog()
|
|
Else
|
|
' Impossibile aprire l'Editor delle lavorazioni delle travi.<br/>Mancano i file di configurazione. - Errore
|
|
MessageBox.Show(EgtMsg(9009), EgtMsg(9008), MessageBoxButton.OK, MessageBoxImage.Stop)
|
|
End If
|
|
Return True
|
|
End Function
|
|
|
|
End Module
|