diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index c44d016..8b91f5a 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -3,7 +3,7 @@ -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() -EgtEnableDebug( true) +EgtEnableDebug( false) -- Imposto direttorio libreria specializzata per Travi EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') @@ -505,7 +505,7 @@ if bToProcess then -- Lavoro le features if not GetDataConfig() then return end BeamExec.GetProcessings( PARTS) - local bOk, Stats = BeamExec.ProcessMachinings( PARTS) + BeamExec.ProcessMachinings( PARTS) local sOutput = '' for i = 1, #RESULT do local sMsg = '' @@ -526,11 +526,14 @@ if bToProcess then WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) -- trovata almeno una strategia ma nessuna applicabile oppure non trovata alcuna strategia elseif RESULT[i].sType == 'Feature' - and ( ( RESULT[i].ChosenStrategy and RESULT[i].ChosenStrategy.sStatus == 'Not-Applicable') - or ( not RESULT[i].ChosenStrategy)) then + and ( ( RESULT[i].ChosenStrategy.sStatus == 'Not-Applicable') + or ( not RESULT[i].ChosenStrategy.sStrategyName)) then nErrCnt = nErrCnt + 1 - sOutput = sOutput .. string.format( '[%d,%d] %s\n', RESULT[i].CutId, RESULT[i].TaskId, sMsg) + if #sMsg == 0 then + sMsg = 'No applicable strategy found' + end + sOutput = sOutput .. string.format( '[%d,%d] %s\n', RESULT[i].idCut, RESULT[i].idTask, sMsg) BEAM.ERR = 19 BEAM.MSG = sMsg BEAM.ROT = -( RESULT[i].nRotation or 1) + 1 @@ -548,7 +551,7 @@ if bToProcess then -- feature incompleta e altro elseif RESULT[i].sType == 'Feature' and RESULT[i].ChosenStrategy.sStatus == 'Not-Completed' then nWarnCnt = nWarnCnt + 1 - sOutput = sOutput .. string.format( '[%d,%d] %s\n', RESULT[i].CutId, RESULT[i].TaskId, sMsg) + sOutput = sOutput .. string.format( '[%d,%d] %s\n', RESULT[i].idCut, RESULT[i].idTask, sMsg) BEAM.ERR = -19 BEAM.MSG = 'Completion : ' .. Proc.nCompletionIndex .. '/5\n' .. sMsg BEAM.ROT = -( RESULT[i].nRotation or 1) + 1 diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 895a1c1..e302e21 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -663,6 +663,10 @@ local function CollectFeatures( Part) table.insert( vProc, Proc) -- altrimenti errore (non ci sono strategie per lavorare la topologia riconosciuta) else + Proc.nFlg = 0 + nProcCount = nProcCount + 1 + Proc.nIndexInVProc = nProcCount + table.insert( vProc, Proc) EgtOutLog( ' Feature ' .. tostring( Proc.idFeature) .. ' : NO available strategies') end -- calcolo riduzione lunghezza pinzabile testa/coda @@ -671,6 +675,10 @@ local function CollectFeatures( Part) Proc.bHindersLaserMeasure = FeatureLib.CalculateFeatureHindersLaserMeasure( Proc, Part) -- altrimenti errore (serviva riconoscimento topologico, ma non è stato possibile farlo) else + Proc.nFlg = 0 + nProcCount = nProcCount + 1 + Proc.nIndexInVProc = nProcCount + table.insert( vProc, Proc) EgtOutLog( ' Feature ' .. tostring( Proc.idFeature) .. ' : NO available strategies') end else @@ -768,15 +776,21 @@ local function GetFeatureInfoAndDependency( vProcSingleRot, Part) -- verifico se il taglio può essere saltato perchè è nella stessa posizione del taglio di testa if Proc.nPrc == 340 and ProcB.Topology.sFamily == 'Cut' and AreSameVectorApprox( ProcB.Faces[1].vtN, X_AX()) and abs( ProcB.Faces[1].ptCenter:getX() - Part.b3Part:getMax():getX()) < 10 * GEO.EPS_SMALL then - Proc.SubstitutedProc = ProcB - ProcB.IsSubstitutedBy = Proc + if not Proc.SlaveProcIndexes then + Proc.SlaveProcIndexes = {} + end + table.insert( Proc.SlaveProcIndexes, j) + ProcB.nIndexMasterProc = i ProcB.nFlg = 0 end -- verifico se il taglio può essere saltato perchè è nella stessa posizione del taglio di coda if Proc.nPrc == 350 and ProcB.Topology.sFamily == 'Cut' and AreSameVectorApprox( ProcB.Faces[1].vtN, -X_AX()) and abs( ProcB.Faces[1].ptCenter:getX() - Part.b3Part:getMin():getX()) < 10 * GEO.EPS_SMALL then - Proc.SubstitutedProc = ProcB - ProcB.IsSubstitutedBy = Proc + if not Proc.SlaveProcIndexes then + Proc.SlaveProcIndexes = {} + end + table.insert( Proc.SlaveProcIndexes, j) + ProcB.nIndexMasterProc = i ProcB.nFlg = 0 end -- verifico se feature tipo LapJoint è attraversata da almeno un foro @@ -960,6 +974,8 @@ local function OrderFeatures( vProc) -- se secondo disabilitato, va lasciato dopo if B1.nFlg ~= 0 and B2.nFlg == 0 then return true + elseif B2.nFlg ~= 0 and B1.nFlg == 0 then + return false -- se entrambi disabilitati seguo l'Id elseif B1.nFlg == 0 and B2.nFlg == 0 then return ( B1.id < B2.id) @@ -1027,14 +1043,13 @@ local function AddFeatureResultToGlobalList( Proc, nRotation) local nCompletionIndex local dCompositeRating local sInfo - -- TODO non funziona perchè il riferimento ad un elemento della stessa tabella fa sparire la Proc sostituita (GetFeatureInfoAndDependency) - if Proc.IsSubstitutedBy then - sStrategyId = Proc.IsSubstitutedBy.ChosenStrategy.sStrategyId - sStatus = Proc.IsSubstitutedBy.ChosenStrategy.Result.sStatus - nCompletionIndex = Proc.IsSubstitutedBy.ChosenStrategy.Result.nCompletionIndex - dCompositeRating = Proc.IsSubstitutedBy.ChosenStrategy.Result.dCompositeRating - sInfo = Proc.IsSubstitutedBy.ChosenStrategy.Result.sInfo - else + if Proc.nIndexMasterProc then + sStrategyId = PROCESSINGS[Proc.nIndexPartInParts].Rotation[Proc.nIndexRotation][Proc.nIndexMasterProc].ChosenStrategy.sStrategyId + sStatus = PROCESSINGS[Proc.nIndexPartInParts].Rotation[Proc.nIndexRotation][Proc.nIndexMasterProc].ChosenStrategy.Result.sStatus + nCompletionIndex = PROCESSINGS[Proc.nIndexPartInParts].Rotation[Proc.nIndexRotation][Proc.nIndexMasterProc].ChosenStrategy.Result.nCompletionIndex + dCompositeRating = PROCESSINGS[Proc.nIndexPartInParts].Rotation[Proc.nIndexRotation][Proc.nIndexMasterProc].ChosenStrategy.Result.dCompositeRating + sInfo = PROCESSINGS[Proc.nIndexPartInParts].Rotation[Proc.nIndexRotation][Proc.nIndexMasterProc].ChosenStrategy.Result.sInfo + elseif Proc.ChosenStrategy then sStrategyId = Proc.ChosenStrategy.sStrategyId sStatus = Proc.ChosenStrategy.Result.sStatus nCompletionIndex = Proc.ChosenStrategy.Result.nCompletionIndex @@ -1390,6 +1405,8 @@ local function GetBestResultFromCombinationsMatrix( ProcessingsOnPart, PartInfo) SingleCombination.nIndexInCombinationList = i SingleCombination.nIndexRotation = nUnloadPos else + ProcessingsOnPart.Rotation[1][nProc].nIndexRotation = nUnloadPos + table.insert( SingleCombination.Rot0, ProcessingsOnPart.Rotation[1][nProc]) SingleCombination.nNotExecute = SingleCombination.nNotExecute + 1 end else