diff --git a/NestProcess.lua b/NestProcess.lua index 82a429f..d07e0e2 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -392,7 +392,8 @@ local function CalculateMove( Beam, dPartLength, sState, State) end -- Bonus Shared Cut: se le normali sono opposte, si risparmia un taglio/posizionamento - if AreOppositeVectorApprox( Beam.LastVtN, State.Tail.vtN) then + local bSharedCut = AreOppositeVectorApprox( Beam.LastVtN, State.Tail.vtN) + if bSharedCut then dScore = dScore + CONFIG.BONUS_SHARED_CUT end @@ -405,7 +406,8 @@ local function CalculateMove( Beam, dPartLength, sState, State) sState = sState, dScore = dScore, dSafeOverlap = dSafeOverlap, - dFutureResidualLength = dFutureResidualLength + dFutureResidualLength = dFutureResidualLength, + bSharedCut = bSharedCut } return Move end @@ -527,7 +529,8 @@ local function CommitBestMove( BestMove) sState = BestMove.sState, dSafeOverlap = BestMove.dSafeOverlap, dLength = Template.dLength, - dPosX = BestMove.dFutureResidualLength + dPosX = BestMove.dFutureResidualLength, + bSharedCut = BestMove.bSharedCut }) -- chiusura job @@ -625,6 +628,8 @@ for i = 1, #RawInventory.ActiveBeams do -- Spostamento pezzi verso la testa della barra e aggiunta duplo local nIndex = 1 + local bSkipNextHeadCut = false + for j = #Beam.NestedParts, 1, -1 do local Part = Beam.NestedParts[j] local nInitialPosition = EgtGetInfo( Part.id, 'INITIALPOSITION', 'i') @@ -635,6 +640,11 @@ for i = 1, #RawInventory.ActiveBeams do -- copia del pezzo (aggiunta duplo) local idDuplo = EgtDuploNew( Part.id) + -- pezzo già intestato dal Tailcut precedente: si segnala all'automatismo che si può saltare Headcut + if bSkipNextHeadCut then + EgtSetInfo( idDuplo, "SKIP_HEADCUT", 1) + end + -- eventuale rotazione if ( EgtStartsWith( Part.sState, '0010') and nInitialPosition == 1) or ( EgtStartsWith( Part.sState, '1000') and nInitialPosition == 3) then @@ -656,6 +666,8 @@ for i = 1, #RawInventory.ActiveBeams do EgtSetInfo( idMachGroup, "PART" .. nIndex, idDuplo .. "," .. dPosX) nIndex = nIndex + 1 + + bSkipNextHeadCut = Part.bSharedCut end end diff --git a/Strategies/Standard/HEADCUT/HEADCUT.lua b/Strategies/Standard/HEADCUT/HEADCUT.lua index 92045a0..b609374 100644 --- a/Strategies/Standard/HEADCUT/HEADCUT.lua +++ b/Strategies/Standard/HEADCUT/HEADCUT.lua @@ -90,8 +90,9 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters) -- TODO di quale utensile si deve impostare la qualità qui? Strategy.Result.dQuality = FeatureLib.GetStrategyQuality( 'SAWBLADE') - -- se coincide con inizio grezzo, non va fatto - if abs( Proc.b3Box:getCenter():getX() - Part.b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL then + -- se settato da saltare o coincide con inizio grezzo, non va fatto + local bSkipHeadCut = ( EgtGetInfo( Part.id, "SKIP_HEADCUT", 'i') or 0) == 1 + if bSkipHeadCut or ( abs( Proc.b3Box:getCenter():getX() - Part.b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL) then return true, Strategy.Result end