891bbd4a08
Corretta sezione Rimossa selezione grezzo Gestione blocco interfaccia su verifica e simula Aggiunta correzione con cancellazione cartelle progetti Tolto ricaricmento progetto nel passaggio da proj a prod Iniziat studio esportazione statistiche Migliorati messaggi su nesting Cambiata gestione tipo progetto
130 lines
5.2 KiB
VB.net
130 lines
5.2 KiB
VB.net
Imports EgtBEAMWALL.Core
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Module LuaExec
|
|
|
|
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 sExecPath As String = ""
|
|
Dim sExecName As String = ""
|
|
GetMainPrivateProfileString(S_BEAM, K_BEAMBWEEXEC, "", sExecName)
|
|
sExecPath = (Map.refMainWindowVM.MainWindowM.sBeamRoot & "\" & sExecName).TrimEnd({"\"c})
|
|
If Not My.Computer.FileSystem.FileExists(sExecPath) Then
|
|
EgtOutLog("Not found BeamExec script " & sExecPath)
|
|
Return False
|
|
End If
|
|
' Assegno i dati
|
|
EgtLuaCreateGlobTable("BEAM")
|
|
EgtLuaSetGlobStringVar("BEAM.FILE", sFile)
|
|
EgtLuaSetGlobStringVar("BEAM.MACHINE", sMachine)
|
|
EgtLuaSetGlobIntVar("BEAM.FLAG", nFlag)
|
|
' 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")
|
|
Return bOk
|
|
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 = ""
|
|
GetMainPrivateProfileString(S_WALL, K_WALLBWEEXEC, "", sExecName)
|
|
sExecPath = (Map.refMainWindowVM.MainWindowM.sWallRoot & "\" & sExecName).TrimEnd({"\"c})
|
|
If Not My.Computer.FileSystem.FileExists(sExecPath) Then
|
|
EgtOutLog("Not found WallExec script " & sExecPath)
|
|
Return False
|
|
End If
|
|
' Assegno i dati
|
|
EgtLuaCreateGlobTable("WALL")
|
|
EgtLuaSetGlobStringVar("WALL.FILE", sFile)
|
|
EgtLuaSetGlobStringVar("WALL.MACHINE", sMachine)
|
|
EgtLuaSetGlobIntVar("WALL.FLAG", nFlag)
|
|
' 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")
|
|
Return bOk
|
|
End Function
|
|
|
|
Friend Function ExecNesting(sFile As String, sMachine As String, PartList As List(Of BTLPartM), dLength As Double, dWidth As Double, dStartOffset As Double, dOffset As Double, dKerf As Double, nQty As Integer, nNestTime As Integer) As Boolean
|
|
If PartList.Count = 0 Then
|
|
EgtOutLog("Exit nesting: no parts received!")
|
|
Return True
|
|
End If
|
|
EgtOutLog("-- Start ExecNest --")
|
|
' Recupero lo script da eseguire
|
|
Dim sExecPath As String = ""
|
|
Dim sExecName As String = ""
|
|
GetMainPrivateProfileString(S_NEST, K_NESTEXEC, "", sExecName)
|
|
Dim sRoot As String = ""
|
|
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
|
|
sRoot = Map.refMainWindowVM.MainWindowM.sBeamRoot
|
|
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
|
|
sRoot = Map.refMainWindowVM.MainWindowM.sWallRoot
|
|
End If
|
|
sExecPath = (sRoot & "\" & sExecName).TrimEnd({"\"c})
|
|
If Not My.Computer.FileSystem.FileExists(sExecPath) Then
|
|
EgtOutLog("Not found NestExec script " & sExecPath)
|
|
Return False
|
|
End If
|
|
' Assegno i dati
|
|
EgtLuaCreateGlobTable("NEST")
|
|
EgtLuaSetGlobStringVar("NEST.FILE", sFile)
|
|
EgtLuaSetGlobStringVar("NEST.MACHINE", sMachine)
|
|
EgtLuaSetGlobNumVar("NEST.LEN", dLength)
|
|
EgtLuaSetGlobNumVar("NEST.WIDTH", dWidth)
|
|
EgtLuaSetGlobNumVar("NEST.STARTOFFSET", dStartOffset)
|
|
EgtLuaSetGlobNumVar("NEST.OFFSET", dOffset)
|
|
EgtLuaSetGlobNumVar("NEST.KERF", dKerf)
|
|
EgtLuaSetGlobStringVar("NEST.MATERIAL", PartList(0).sMATERIAL)
|
|
EgtLuaSetGlobNumVar("NEST.QTY", nQty)
|
|
EgtLuaSetGlobNumVar("NEST.TIME", nNestTime)
|
|
EgtLuaSetGlobNumVar("NEST.PRODID", Map.refProdManagerVM.CurrProd.nProdId)
|
|
EgtLuaCreateGlobTable("PART")
|
|
For PartIndex = 0 To PartList.Count - 1
|
|
EgtLuaSetGlobIntVar("PART." & PartList(PartIndex).nPartId.ToString(), PartList(PartIndex).m_nCNT + PartList(PartIndex).m_nADDED - PartList(PartIndex).nINPROD)
|
|
Next
|
|
' Eseguo lo script
|
|
Dim bOk As Boolean = False
|
|
If EgtLuaExecFile(sExecPath) Then
|
|
' Recupero i risultati
|
|
Dim nErr As Integer = 999
|
|
EgtLuaGetGlobIntVar("NEST.ERR", nErr)
|
|
bOk = (nErr <= 0)
|
|
If Not bOk Then EgtOutLog("NestExec Err=" & nErr.ToString())
|
|
Else
|
|
bOk = False
|
|
EgtOutLog("Error executing Nest Exec script " & sExecPath)
|
|
End If
|
|
' Cancello tavola globale
|
|
EgtLuaResetGlobVar("NEST")
|
|
EgtLuaResetGlobVar("PART")
|
|
Return bOk
|
|
End Function
|
|
|
|
End Module
|