e0b69567e3
- modifica per entrare da TS3 modalità Vista con Simulazione non bloccata anche per pareti (precedente era valida solo per travi).
94 lines
4.0 KiB
VB.net
94 lines
4.0 KiB
VB.net
Imports System.IO
|
|
Imports System.Globalization
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Module Wall
|
|
|
|
Friend Function VerifyWall(sFile As String, sMachine As String, nFlag As Integer) As Boolean
|
|
' Se abilitato, esco con successo
|
|
If IsActiveWall() Then Return True
|
|
' Segnalo il problema
|
|
Dim sErr As String = "Wall 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 ExecWall(sFile As String, sMachine As String, nFlag As Integer, bBtl As Boolean) As Boolean
|
|
EgtOutLog("-- Start ExecWall --")
|
|
' Recupero lo script da eseguire
|
|
Dim sExecPath As String = ""
|
|
Dim sExecName As String = ""
|
|
GetPrivateProfileString(S_WALL, If(bBtl, K_WALLBTLEXEC, K_WALLBWEEXEC), "", sExecName)
|
|
sExecPath = (IniFile.m_sWallDirPath & "\" & sExecName).TrimEnd({"\"c})
|
|
If Not My.Computer.FileSystem.FileExists(sExecPath) Then
|
|
EgtOutLog("Not found WallExec script " & sExecPath)
|
|
Return False
|
|
End If
|
|
' Preparo interfaccia per aggiornamento
|
|
Map.refManageLayerExpanderVM.ClearObjTree()
|
|
' Assegno i dati
|
|
EgtLuaCreateGlobTable("WALL")
|
|
EgtLuaSetGlobStringVar("WALL.BASEDIR", IniFile.m_sWallDirPath)
|
|
EgtLuaSetGlobStringVar("WALL.FILE", sFile)
|
|
EgtLuaSetGlobStringVar("WALL.MACHINE", sMachine)
|
|
EgtLuaSetGlobIntVar("WALL.FLAG", nFlag)
|
|
' variabile che comunica al lua che e' stato avviato da interfaccia BEAMWALL (per gestione messaggi errore lua)
|
|
If Not bBtl Then EgtLuaSetGlobBoolVar("WALL.BW", True)
|
|
' Eseguo lo script
|
|
Dim bOk As Boolean = False
|
|
If EgtLuaExecFile(sExecPath) Then
|
|
' Recupero i risultati
|
|
Dim nErr As Integer = 999
|
|
EgtLuaGetGlobIntVar("WALL.ERR", nErr)
|
|
bOk = (nErr <= 0)
|
|
If Not bOk Then EgtOutLog("WallExec Err=" & nErr.ToString())
|
|
Else
|
|
bOk = False
|
|
EgtOutLog("Error executing Wall Exec script " & sExecPath)
|
|
End If
|
|
' Cancello tavola globale
|
|
EgtLuaResetGlobVar("WALL")
|
|
' Aggiorno interfaccia
|
|
Map.refProjectVM.UpdateProjectUI(True)
|
|
Map.refManageLayerExpanderVM.SelectIdInObjTreeNoMark(EgtGetCurrLayer())
|
|
If EgtGetCurrMachGroup() <> GDB_ID.NULL Then
|
|
Map.refTopCommandBarVM.SetMachiningMode()
|
|
' Se simulazione
|
|
If bOk And nFlag = 2 Then
|
|
' Se da TS3 e non pezzo da Vista, impedisco di fare altro
|
|
If bBtl AndAlso sFile.IndexOf( "Part_", StringComparison.InvariantCulture) = -1 Then
|
|
Map.refSimulationExpanderVM.bOnlySimulation = True
|
|
End If
|
|
' Vado in simulazione
|
|
Map.refSimulationExpanderVM.Simulation_IsExpanded = True
|
|
End If
|
|
End If
|
|
Return bOk
|
|
End Function
|
|
|
|
Friend Function WallMachDb() As Boolean
|
|
' Assegno le path
|
|
Dim sBaseDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\" & "Wall"
|
|
' verifico se ci sono i file ini
|
|
Dim sMachTypePath As String = sBaseDir & "\MachiningTypes.ini"
|
|
Dim sTabTemplPath As String = sBaseDir & "\WallTableTemplate.ini"
|
|
If File.Exists(sMachTypePath) AndAlso File.Exists(sTabTemplPath) Then
|
|
' apro finestra di gestione lavorazioni pareti
|
|
Dim sTitle = EgtMsg(9010) 'Tabelle delle lavorazioni delle pareti
|
|
Dim WallMchsWinVM As New BeamMachiningsWindowVM(sTitle, sBaseDir, sMachTypePath, sTabTemplPath, False)
|
|
Dim WallMchsWinV As New BeamMachiningsWindowV(Application.Current.MainWindow, WallMchsWinVM)
|
|
WallMchsWinV.ShowDialog()
|
|
Else
|
|
' Impossibile aprire l'Editor delle lavorazioni delle pareti.<br/>Mancano i file di configurazione. - Errore
|
|
MessageBox.Show(EgtMsg(9011), EgtMsg(9008), MessageBoxButton.OK, MessageBoxImage.Stop)
|
|
End If
|
|
Return True
|
|
End Function
|
|
|
|
End Module
|