diff --git a/NestProcess.lua b/NestProcess.lua index c104c90..178cd7a 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -4,7 +4,7 @@ -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() -EgtEnableDebug( true) +EgtEnableDebug( false) -- Include local BeamData = require( 'BeamDataNew') @@ -504,21 +504,24 @@ while true do end end - -- 2 Si provano le barre ancora a stock (VirtualBeam si resetta invece di crearne una nuova per velocizzare il calcolo) - for i = 1, #RawInventory.Stock do - if RawInventory.Stock[i].nCount > 0 then - VirtualBeam.dTotalLength = RawInventory.Stock[i].dLength - VirtualBeam.dResidualLength = RawInventory.Stock[i].dLength - ( NEST.STARTOFFSET or 0) - VirtualBeam.LastOffsetX = { 0, 0, 0, 0} - VirtualBeam.LastVtN = Vector3d( 1, 0, 0) - VirtualBeam.vtNXabs = 1 - VirtualBeam.dLastHeadRecess = 0 - VirtualBeam.NestedParts = {} - local CurrentMove = FindBestPartForBeam( VirtualBeam) - if CurrentMove and CurrentMove.dScore > dHighestScore then - dHighestScore = CurrentMove.dScore - BestMove = CurrentMove - BestMove.nStockIndex = i + -- 2 Si provano le barre ancora a stock SOLO SE NON TROVATA SOLUZIONE CON BARRE ATTIVE + -- VirtualBeam si resetta invece di crearne una nuova per velocizzare il calcolo + if not BestMove then + for i = 1, #RawInventory.Stock do + if RawInventory.Stock[i].nCount > 0 then + VirtualBeam.dTotalLength = RawInventory.Stock[i].dLength + VirtualBeam.dResidualLength = RawInventory.Stock[i].dLength - ( NEST.STARTOFFSET or 0) + VirtualBeam.LastOffsetX = { 0, 0, 0, 0} + VirtualBeam.LastVtN = Vector3d( 1, 0, 0) + VirtualBeam.vtNXabs = 1 + VirtualBeam.dLastHeadRecess = 0 + VirtualBeam.NestedParts = {} + local CurrentMove = FindBestPartForBeam( VirtualBeam) + if CurrentMove and CurrentMove.dScore > dHighestScore then + dHighestScore = CurrentMove.dScore + BestMove = CurrentMove + BestMove.nStockIndex = i + end end end end