28ca22ee35
- Aggiunta opzione abilitadisabilita area pnte lunghe in nesting
200 lines
8.0 KiB
VB.net
200 lines
8.0 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), SectionList As List(Of SParam), dStartOffset As Double, dOffset As Double, dKerf As Double, bLDIntersOther As Boolean, 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)
|
|
EgtLuaSetGlobBoolVar("NEST.DRILL_MACH_AREA", bLDIntersOther)
|
|
Dim nNestCorner As Integer
|
|
Select Case CurrentMachine.NestingCorner
|
|
Case MCH_CR.TL
|
|
nNestCorner = 1
|
|
Case MCH_CR.TR
|
|
nNestCorner = 3
|
|
Case MCH_CR.BL
|
|
nNestCorner = 0
|
|
Case MCH_CR.BR
|
|
nNestCorner = 2
|
|
End Select
|
|
EgtLuaSetGlobNumVar("NEST.CORNER", nNestCorner)
|
|
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
|
|
EgtLuaCreateGlobTable("LEN")
|
|
For SectionIndex = 0 To SectionList.Count - 1
|
|
EgtLuaSetGlobNumVar("LEN." & SectionIndex + 1, SectionList(SectionIndex).dL)
|
|
Next
|
|
EgtLuaCreateGlobTable("WIDTH")
|
|
For SectionIndex = 0 To SectionList.Count - 1
|
|
EgtLuaSetGlobNumVar("WIDTH." & SectionIndex + 1, SectionList(SectionIndex).dW)
|
|
Next
|
|
EgtLuaCreateGlobTable("QTY")
|
|
For SectionIndex = 0 To SectionList.Count - 1
|
|
EgtLuaSetGlobNumVar("QTY." & SectionIndex + 1, SectionList(SectionIndex).nQuantity)
|
|
Next
|
|
EgtLuaCreateGlobTable("MATERIAL")
|
|
For SectionIndex = 0 To SectionList.Count - 1
|
|
EgtLuaSetGlobStringVar("MATERIAL." & SectionIndex + 1, SectionList(SectionIndex).SectXMat.sSectionXMaterial)
|
|
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
|
|
|
|
Friend Function ExecRotFlip(nPartId As Integer) As Boolean
|
|
If IsNothing(nPartId) OrElse nPartId = GDB_ID.NULL Then
|
|
EgtOutLog("Exit nesting: no parts received!")
|
|
Return True
|
|
End If
|
|
EgtOutLog("-- Start ExecFlipRot --")
|
|
' Recupero lo script da eseguire
|
|
Dim sExecPath As String = ""
|
|
Dim sExecName As String = ""
|
|
GetMainPrivateProfileString(S_NEST, K_FLIPROT, "", 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("NFAR")
|
|
EgtLuaSetGlobStringVar("NFAR.PARTID", nPartId)
|
|
' Eseguo lo script
|
|
Dim bOk As Boolean = False
|
|
If EgtLuaExecFile(sExecPath) Then
|
|
' Recupero i risultati
|
|
Dim nErr As Integer = 999
|
|
EgtLuaGetGlobIntVar("NFAR.ERR", nErr)
|
|
bOk = (nErr <= 0)
|
|
If Not bOk Then EgtOutLog("FlipRot Err=" & nErr.ToString())
|
|
Else
|
|
bOk = False
|
|
EgtOutLog("Error executing Nest FlipRot script " & sExecPath)
|
|
End If
|
|
' Cancello tavola globale
|
|
EgtLuaResetGlobVar("NFAR")
|
|
Return bOk
|
|
End Function
|
|
|
|
End Module
|