diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index f1a2f0d..a5d8226 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -442,11 +442,9 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS) -- aggiorno grezzo precedente idPrevRaw = PARTS[i].idRaw dPrevDelta = dDelta - -- TODO dDistanceToNextPiece è errato, va calcolato tenendo conto dei 3 casi (altro pezzo successivo, ultimo pezzo con dietro grezzo scaricabile, ultimo pezzo con dietro grezzo a perdere) - PARTS[i].dDistanceToNextPiece = dDelta - - PARTS[i].dRestLength = dLen PARTS[i].bIsLastPart = ( i == #PARTS) + PARTS[i].dDistanceToNextPiece = dDelta + PARTS[i].dRestLength = dLen PARTS[i].b3Raw = EgtGetRawPartBBox( PARTS[i].idRaw) PARTS[i].dLength = PARTS[i].b3Raw:getDimX() PARTS[i].dWidth = PARTS[i].b3Raw:getDimY() @@ -468,14 +466,20 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS) end -- Se rimasto materiale aggiungo grezzo dell'avanzo + -- TODO valutare se ridurre la dLen minima perchè crea discrepanze tra lunghezza inserita e VMill if dLen > 10 then - PARTS[#PARTS].bNextIsRaw = true local idRaw = EgtAddRawPart( Point3d(0,0,0), dLen, dRawW, dRawH, BeamData.RAWCOL) EgtMoveToCornerRawPart( idRaw, BeamData.ptOriXR, BeamData.dPosXR) EgtMoveRawPart( idRaw, Vector3d( dLen - dRawL, 0, 0)) -- assegno ordine in lavorazione nCnt = nCnt + 1 EgtSetInfo( idRaw, 'ORD', nCnt) + -- aggiorno distanza dell'ultimo pezzo dall'eventuale grezzo scaricabile + if EgtGetRawPartBBox( idRaw):getDimX() < BeamData.dMinRaw then + PARTS[#PARTS].dDistanceToNextPiece = 10000 + end + else + PARTS[#PARTS].dDistanceToNextPiece = 10000 end return true diff --git a/Strategies/Standard/STR0004/STR0004.lua b/Strategies/Standard/STR0004/STR0004.lua index 57bffd0..c83c3e8 100644 --- a/Strategies/Standard/STR0004/STR0004.lua +++ b/Strategies/Standard/STR0004/STR0004.lua @@ -149,7 +149,6 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters) return false, Strategy.Result end - -- TODO dDistanceToNextPiece è errato, va calcolato tenendo conto dei 3 casi (altro pezzo successivo, ultimo pezzo con dietro grezzo scaricabile, ultimo pezzo con dietro grezzo a perdere) local dExtendAfterTail = max( Part.dDistanceToNextPiece - BeamData.CUT_EXTRA, 0) if MachiningLib.CanExtendAfterTail( Strategy.Parameters.sCanDamageNextPiece, Part) then dExtendAfterTail = 10000