From 10056ea26696fb25ed1ca082b4aa40509b1d8363 Mon Sep 17 00:00:00 2001 From: DarioS Date: Mon, 12 Jul 2021 16:28:57 +0200 Subject: [PATCH] DataBeam : - correzione a nesting per evitare barre vuote inutili. --- NestProcess.lua | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/NestProcess.lua b/NestProcess.lua index 600f15d..6dba0dd 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -165,31 +165,33 @@ local dTime = 0 while Raws.Count > 0 and PartsToFill( Parts) > 0 do -- Eseguo ottimizzazione per una barra e visualizzo il risultato local Res = ExecMaximumFilling( Raws, Parts) - -- creo gruppo di lavorazione - local MachGroupName = NewMachGroupName() - nMachGroup = EgtAddMachGroup( MachGroupName) - EgtSetInfo( nMachGroup, "BARLEN", Raws.LenToFill) - EgtSetInfo( nMachGroup, "MATERIAL", NEST.MATERIAL) - EgtSetInfo( nMachGroup, "AUTONEST", 1) - -- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione - EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID) - EgtSetInfo( nMachGroup, "PATTID", nMachGroup) - -- Disegno i pezzi - local CurrX = Raws.StartGap - local nInfoIndex = 1 - for i = 1, Res.DiffParts do - local PartIndex = Res.Data[i].Id - local PartId = Parts[PartIndex].Id - local dLen = Parts[PartIndex].Len - for j = 1, Res.Data[i].Count do - -- creo pezzo copia - local nPartDuploId = EgtDuploNew( PartId) - EgtSetInfo( nMachGroup, "PART" .. nInfoIndex, nPartDuploId .. "," .. CurrX) - CurrX = CurrX + dLen + Raws.MidGap - nInfoIndex = nInfoIndex + 1 + -- verifico se ci sono pezzi + if Res.DiffParts > 0 then + -- creo gruppo di lavorazione + local MachGroupName = NewMachGroupName() + nMachGroup = EgtAddMachGroup( MachGroupName) + EgtSetInfo( nMachGroup, "BARLEN", Raws.LenToFill) + EgtSetInfo( nMachGroup, "MATERIAL", NEST.MATERIAL) + EgtSetInfo( nMachGroup, "AUTONEST", 1) + -- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione + EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID) + EgtSetInfo( nMachGroup, "PATTID", nMachGroup) + -- Disegno i pezzi + local CurrX = Raws.StartGap + local nInfoIndex = 1 + for i = 1, Res.DiffParts do + local PartIndex = Res.Data[i].Id + local PartId = Parts[PartIndex].Id + local dLen = Parts[PartIndex].Len + for j = 1, Res.Data[i].Count do + -- creo pezzo copia + local nPartDuploId = EgtDuploNew( PartId) + EgtSetInfo( nMachGroup, "PART" .. nInfoIndex, nPartDuploId .. "," .. CurrX) + CurrX = CurrX + dLen + Raws.MidGap + nInfoIndex = nInfoIndex + 1 + end end end - -- Aggiorno per prossima iterazione Raws.Count = Raws.Count - 1 for i = 1, Res.DiffParts do