From d49cb93e3622e3b76c1581bc329922e875d5ab42 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 6 Oct 2022 09:48:11 +0200 Subject: [PATCH] =?UTF-8?q?-=20in=20NestProcess=20corretto=20bug=20che=20m?= =?UTF-8?q?oltiplicava=20i=20pezzi=20se=20erano=20presenti=20pi=C3=B9=20gr?= =?UTF-8?q?ezzi=20della=20stessa=20sezione?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NestProcess.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/NestProcess.lua b/NestProcess.lua index 0025ac2..be7ea92 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -1,6 +1,7 @@ -- BeamNestProcess.lua by Egaltech s.r.l. 2021/06/14 -- Gestione nesting automatico travi -- 2022/10/05 Piccole modifiche per far funzionare correttamente i compilati +-- 2022/10/06 Corretto bug che moltiplicava i pezzi se erano presenti più grezzi della stessa sezione -- Intestazioni require( 'EgtBase') @@ -169,15 +170,19 @@ end -- Pezzi local Parts = {} +-- cerco il grezzo con la lunghezza maggiore, epurata dello start gap +local maxRawLenToFillNoStartGap = 0 +for RawIndex = 1, #Raws do + maxRawLenToFillNoStartGap = max( maxRawLenToFillNoStartGap, Raws[RawIndex].LenToFill - Raws[RawIndex].StartGap) +end -- ciclo su pezzi per aggiungerli al nesting for nPartId, nCount in pairs( PART) do -- recupero lunghezza pezzo local Len = EgtGetInfo( nPartId, "L", 'd') local DispLen = EgtIf( Len <= 1000, 2000, 0) --EgtIf( Len <= 2000, max( 2000, 6000 - Len), 0) - for RawIndex = 1, #Raws do - if Len + Raws[RawIndex].StartGap < Raws[RawIndex].LenToFill then - table.insert( Parts, {Id = nPartId, Len = Len, DispLen = DispLen, Cnt = nCount}) - end + -- aggiungo il pezzo solo se ci sta nel grezzo più lungo a disposizione + if Len < maxRawLenToFillNoStartGap then + table.insert( Parts, {Id = nPartId, Len = Len, DispLen = DispLen, Cnt = nCount}) end end