diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index 874cdd0..f66ab25 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -554,7 +554,13 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus EgtOutLog( sErr) return false, sErr end - + + -- verifico se la parte rimanente della barra è riutilizzabile + local nNextRawId = EgtGetNextRawPart( nRawId) + local bIsNextRawPartUnloadable = nNextRawId and + EgtGetPartInRawPartCount( nNextRawId) <= 0 and + EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw + -- Se non limitato o forzato uso lama e da sopra e richiesto con doppio taglio di lama e superiore al limite minimo if ( ( not bLimXmin and not bLimXmax) or bForceUseBladeOnNotThruFace) and ( bCanUseUnderBlade or bCanUseBlade) and nUseBlade > 0 and b3Solid:getDimX() > dLimMinPiece - 1 then local sCutting @@ -601,9 +607,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus end end end - local nNextRawId = EgtGetNextRawPart( nRawId) -- se la fine (a sinistra) non è limitata e ho un pezzo successivo meno distante di metà raggio, oppure se grezzo finale della barra di lunghezza sufficiente, setto la fine come limitata - if ((( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2)) or (nNextRawId and EgtGetPartInRawPartCount( nNextRawId) <= 0 and EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw)) and not bLimXmin then + if ((( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2)) or bIsNextRawPartUnloadable) and not bLimXmin then if bForceUseBladeOnNotThruFace then bForcedLim = true bLimXmin = true @@ -999,8 +1004,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth end end - -- se la fine (a sinistra) non è limitata e ho un pezzo successivo meno distante di metà raggio. setto la fine come limitata - if dDistToNextPiece < dToolDiam/2 and not bLimXmin then + -- se la fine (a sinistra) non è limitata e ho un pezzo successivo meno distante di metà raggio, oppure se grezzo finale della barra di lunghezza sufficiente, setto la fine come limitata + if ( dDistToNextPiece < dToolDiam/2 or bIsNextRawPartUnloadable) and not bLimXmin then bForcedLim = true bLimXmin = true end