From 37ff2e7f4c8be3c5d5499ddb55765679e015c45d Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 16 Jul 2026 17:07:28 +0200 Subject: [PATCH] - in BeamExec.ProcessAlternatives si azzerano le alternative non usate --- LuaLibs/BeamExec.lua | 46 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index f352374..ad16fd4 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -2642,17 +2642,43 @@ function BeamExec.ProcessAlternatives( PARTS) end -- passaggio info a interfaccia da scrivere sul pezzo - BEAM.INFONGEPART = {} - for i = 1, #AlternativesNest2D do - if PARTS[nPart].HeadcutInfo then - local sOffsetX = table.concat( PARTS[nPart].HeadcutInfo[AlternativesNest2D[i]].OffsetX, ',') - local sVtN = ( tostring( PARTS[nPart].HeadcutInfo[AlternativesNest2D[i]].vtN)):gsub("^%(", ""):gsub("%)$", "") - table.insert( BEAM.INFONGEPART, 'ALT' .. AlternativesNest2D[i].. '_H' .. '=' .. sOffsetX .. ';' .. sVtN ) + local function IsStateInAlternativesNest2D( sState) + for _, v in ipairs( AlternativesNest2D) do + if v == sState then + return true + end end - if PARTS[nPart].TailcutInfo then - local sOffsetX = table.concat( PARTS[nPart].TailcutInfo[AlternativesNest2D[i]].OffsetX, ',') - local sVtN = ( tostring( PARTS[nPart].TailcutInfo[AlternativesNest2D[i]].vtN)):gsub("^%(", ""):gsub("%)$", "") - table.insert( BEAM.INFONGEPART, 'ALT' .. AlternativesNest2D[i] .. '_T' .. '=' .. sOffsetX .. ';' .. sVtN) + return false + end + BEAM.INFONGEPART = {} + local States = { + "1000", + "0100", + "0010", + "0001", + "1000_INV", + "0100_INV", + "0010_INV", + "0001_INV", + } + for i = 1, #States do + local sState = States[i] + if IsStateInAlternativesNest2D( sState) then + if PARTS[nPart].HeadcutInfo then + local HeadcutInfo = PARTS[nPart].HeadcutInfo[sState] + local sOffsetX = table.concat( HeadcutInfo.OffsetX, ',') + local sVtN = ( tostring( HeadcutInfo.vtN)):gsub("^%(", ""):gsub("%)$", "") + table.insert( BEAM.INFONGEPART, 'ALT' .. sState.. '_H' .. '=' .. sOffsetX .. ';' .. sVtN ) + end + if PARTS[nPart].TailcutInfo then + local TailCutInfo = PARTS[nPart].TailcutInfo[sState] + local sOffsetX = table.concat( TailCutInfo.OffsetX, ',') + local sVtN = ( tostring( TailCutInfo.vtN)):gsub("^%(", ""):gsub("%)$", "") + table.insert( BEAM.INFONGEPART, 'ALT' .. sState .. '_T' .. '=' .. sOffsetX .. ';' .. sVtN) + end + else + table.insert( BEAM.INFONGEPART, 'ALT' .. sState.. '_H' .. '= ') + table.insert( BEAM.INFONGEPART, 'ALT' .. sState.. '_T' .. '= ') end end