From a404bf2f9e9f98221d3dbd5d2f93c5cf49731fa1 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 18 May 2026 12:03:46 +0200 Subject: [PATCH] =?UTF-8?q?-=20in=20NestProcess=20si=20provano=20barre=20n?= =?UTF-8?q?uove=20solo=20se=20non=20si=20trovano=20soluzioni=20con=20quell?= =?UTF-8?q?e=20gi=C3=A0=20attive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NestProcess.lua | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) 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