diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index 6219672..e6cd8b7 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -1,4 +1,4 @@ --- ProcessLongCut.lua by Egaltech s.r.l. 2023/05/03 +-- ProcessLongCut.lua by Egaltech s.r.l. 2023/05/19 -- Gestione calcolo taglio longitudinale per Travi -- 2021/02/03 Corretto FaceUse con fresa orizzontale su taglio orizzontale. -- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto. @@ -27,6 +27,7 @@ -- 2023/03/22 Correzione a SCC lama a seguito di modifiche alle direzioni dei tagli. -- 2023/04/17 Gestione unificata SCC tramite funzione apposita GetSCC -- 2023/05/03 Corretto SCC in caso di asse utensile allineato con Z. +-- 2023/05/19 Migliorato calcolo e verifica affondamento per lavorazione con lama con codolo in mezzo. -- Tabella per definizione modulo local ProcessLongCut = {} @@ -725,11 +726,12 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus local dToolDiam = 0 local dThick = 0 local dMaxDepth = 0 + local dMaxVertDepth = 0 local sCuttingDn local dToolDiamDn = 0 local dThickDn = 0 local dMaxDepthDn = 0 - -- recupero la lavorazione + -- recupero eventuale lavorazione con lama su testa da sotto if bCanUseUnderBlade then sCuttingDn = ML.FindCutting( 'HeadSide_H2', false, true) if not sCuttingDn then @@ -747,6 +749,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus end end end + -- recupero eventuale lavorazione con lama if bCanUseBlade then local sCutType = EgtIf( BD.USE_LONGCUT, 'LongCut', 'HeadSide') sCutting = ML.FindCutting( sCutType) @@ -762,6 +765,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam dThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dThick dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth + dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0) end end end @@ -916,25 +920,23 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus end -- si percorrono i lati alto e basso della faccia -- calcolo quanto è l'affondamento del taglio - local dOffsetTopBlade = ( dWidth + dDimStrip) / 2 - local dOffsetDownBlade = ( dWidth + dDimStrip) / 2 - if bFinishWithChainSaw then - dOffsetTopBlade = dWidth / 2 - dOffsetDownBlade = dWidth / 2 - end + local dMainMaxDepth = EgtIf( abs( vtN:getY()) < 1e-6, dMaxDepth, dMaxVertDepth) + local dOtherMaxDept = EgtIf( bCanUseUnderBlade, dMaxDepthDn, dMainMaxDepth) + local dCoeff = min( ( dWidth - dDimStrip) / ( dMainMaxDepth + dOtherMaxDept), 1) + local dOffsetTopBlade = dWidth - dCoeff * dMainMaxDepth + local dOffsetDownBlade = dWidth - dCoeff * dOtherMaxDept local nStepDownBlade = 1 - local dStepDownBlade = dWidth - dOffsetDownBlade + local dStepDownBlade = dOtherMaxDept -- se lama da sotto verifico se la componente Y della profondità di taglio supera la capacità della lama - if ( nSide == -1 or abs(nSide) == 2) and bCanUseUnderBlade and (( dWidth - dDimStrip) / 2) > dMaxDepthDn then + if ( nSide == -1 or abs(nSide) == 2) and bCanUseUnderBlade and ( dOffsetTopBlade - dDimStrip) > dOtherMaxDept then if bFinishWithChainSaw then - dOffsetTopBlade = max( dWidth - dMaxDepth + ( BD.DECR_VERT_CUT or 0), dOffsetTopBlade) - dOffsetDownBlade = max( dWidth - dMaxDepthDn, dOffsetDownBlade) local dHCutDownBlade = dWidth - dOffsetDownBlade - local dMaxStepDownBlade = 64 + local dMaxStepDownBlade = 80 nStepDownBlade = ceil( dHCutDownBlade / dMaxStepDownBlade) dStepDownBlade = dHCutDownBlade / nStepDownBlade else - local sErr = 'Error : side depth is bigger than underneath blade cut depth' + local dDelta = dWidth - dDimStrip - ( dMainMaxDepth + dOtherMaxDept) + local sErr = 'Error : side depth is bigger than total cut depth (Diff=' .. EgtNumToString( dDelta)..')' EgtOutLog( sErr) return false, sErr end diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index a433879..797720a 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -125,9 +125,9 @@ function ProcessLong2Cut.GetLongFacesCount( Proc) end --------------------------------------------------------------------- -local function MakeSideFace( nId, nFac, nSideLimitingFace, sMilling, dToolDiam, nL2CSide, bIsAnyFaceUpsideDown) - if ( not BD.DOWN_HEAD or not BD.TURN) and bIsAnyFaceUpsideDown then - EgtOutLog( 'Long2Cut : side face finishing skipped , down head required') +local function MakeSideFace( nId, nFac, nSideLimitingFace, nInd, sMilling, dToolDiam, nL2CSide, bIsAnyFaceUpsideDown) + if ( not BD.DOWN_HEAD and not BD.TURN) and bIsAnyFaceUpsideDown then + EgtOutLog( 'Long2Cut : side face finishing skipped, down head required') return true end -- inserisco la lavorazione @@ -141,8 +141,15 @@ local function MakeSideFace( nId, nFac, nSideLimitingFace, sMilling, dToolDiam, -- aggiungo geometria EgtSetMachiningGeometry( {{ nId, nFac}}) -- lato di lavoro e inversione - EgtSetMachiningParam( MCH_MP.INVERT, false) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + if BD.TURN and + ( ( nSideLimitingFace == 1 and nInd == EgtIf( nL2CSide ~= -1, 2, 1)) or + ( nSideLimitingFace == -1 and nInd == EgtIf( nL2CSide ~= -1, 1, 2))) then + EgtSetMachiningParam( MCH_MP.INVERT, true) + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) + else + EgtSetMachiningParam( MCH_MP.INVERT, false) + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + end -- uso della faccia local nFaceUse = EgtIf( nSideLimitingFace == 1, MCH_MILL_FU.ORTHO_RIGHT, MCH_MILL_FU.ORTHO_LEFT) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) @@ -151,8 +158,11 @@ local function MakeSideFace( nId, nFac, nSideLimitingFace, sMilling, dToolDiam, -- attacco e uscita EgtSetMachiningParam( MCH_MP.LIPERP, 0) EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2 + 30) - EgtSetMachiningParam( MCH_MP.LOPERP, 2) + EgtSetMachiningParam( MCH_MP.LOPERP, 5) EgtSetMachiningParam( MCH_MP.LOTANG, 10) + if BD.TURN then + EgtSetMachiningParam( MCH_MP.LOELEV, 10) + end -- se faccia di fianco e testa da sotto, aumento la sicurezza if nL2CSide == 0 and BD.DOWN_HEAD then EgtSetMachiningParam( MCH_MP.STARTPOS, 80) @@ -1095,6 +1105,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster local nPos = EgtIf( i == 1, j, nC - j + 1) local dSal = EgtIf( nPos == 1, - EgtIf( i == nIni, dStartDist, dEndDist), - EgtIf( i == nIni, dStartAccDist, dEndAccDist) - ( nPos - 2) * dC + EgtIf( bSide, dOverLapExtend, 0)) local dEal = EgtIf( nPos == nC, - EgtIf( i == nIni, dEndDist, dStartDist), - EgtIf( i == nIni, dEndAccDist, dStartAccDist) - ( nC - nPos - 1) * dC + EgtIf( bSide, dOverLapExtend, 0)) + if nSide == -1 then + dSal, dEal = dEal, dSal + end -- Posizione braccio portatesta local nSCC = MCH_SCC.NONE if not BD.C_SIMM then @@ -1178,11 +1191,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster end -- se facce principali convesse, eventuale lavorazione della faccia limitante l'inizio (a destra) if bConvex and j == 1 and not bStartFixed then - MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], 1, sMilling, dToolDiam, nSide, bIsAnyFaceUpsideDown) + MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], 1, i, sMilling, dToolDiam, nSide, bIsAnyFaceUpsideDown) end -- se facce principali convesse, eventuale lavorazione della faccia limitante la fine (a sinistra) if bConvex and j == nC and not bEndFixed then - MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], -1, sMilling, dToolDiam, nSide, bIsAnyFaceUpsideDown) + MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], -1, i, sMilling, dToolDiam, nSide, bIsAnyFaceUpsideDown) end end end @@ -1620,11 +1633,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster end -- se facce principali convesse, eventuale lavorazione della faccia limitante l'inizio (a destra) if bConvex and j == 1 and not bStartFixed and bRemoveToolRadius then - MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], 1, sMilling, dToolDiam) + MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], 1, i, sMilling, dToolDiam) end -- se facce principali convesse, eventuale lavorazione della faccia limitante la fine (a sinistra) if bConvex and j == nC and not bEndFixed and bRemoveToolRadius then - MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], -1, sMilling, dToolDiam) + MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], -1, i, sMilling, dToolDiam) end end end