From 2e25eb86e32aef8047a226d81bccdfa61e5a8c6d Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 23 Feb 2023 15:01:29 +0100 Subject: [PATCH] Improvement/LongCutBetterFeedDirection: - in LongCut e LongDoubleCut nuova gestione del verso di avanzamento ottimale che contempla tutti i casi --- LuaLibs/ProcessLongCut.lua | 87 ++++++++++++++++++++------ LuaLibs/ProcessLongDoubleCut.lua | 101 +++++++++++++++++++++++-------- 2 files changed, 146 insertions(+), 42 deletions(-) diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index a4d3765..8f78190 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -21,6 +21,7 @@ -- 2023/01/27 In caso di lavorazione aggiuntiva con fresa a catena il taglio con lama da sotto viene effettuato a step. -- 2023/02/15 Migliorato verso di avanzamento della lama. -- 2023/02/21 Verso di avanzamento della lama migliorato anche con lama LC. +-- 2023/02/22 Nuova gestione del verso di avanzamento ottimale che contempla tutti i casi. -- Tabella per definizione modulo local ProcessLongCut = {} @@ -922,29 +923,79 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus if ( not bFront and k == 1) or ( bFront and k == 2) then dSal, dEal = dEal, dSal end - + + + -- verifico lama in uso e imposto uso faccia + local bIsTopBladeCurrent + local nFaceUseCurrent if bCanUseBlade and bCanUseUnderBlade then - EgtSetMachiningParam( MCH_MP.INVERT, true) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) - dSal, dEal = dEal, dSal - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse)) - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse)) - elseif bCanUseUnderBlade then - if abs(nSide) ~= 2 then - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + if k == 1 then + bIsTopBladeCurrent = true + nFaceUseCurrent = nFaceUse2 + else + bIsTopBladeCurrent = false + nFaceUseCurrent = nFaceUse + end + elseif bCanUseUnderBlade then + if k == 1 then + bIsTopBladeCurrent = false + nFaceUseCurrent = nFaceUse + else + bIsTopBladeCurrent = false + nFaceUseCurrent = nFaceUse2 end - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2)) else - EgtSetMachiningParam( MCH_MP.INVERT, false) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) - dSal, dEal = dEal, dSal - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2)) + if k == 1 then + bIsTopBladeCurrent = true + nFaceUseCurrent = nFaceUse + else + bIsTopBladeCurrent = true + nFaceUseCurrent = nFaceUse2 + end end + -- recupero alcune informazioni utili dalla lavorazione attuale + local bIsCurrentBladeCW + local bIsCurrentMachiningInverted + if bIsTopBladeCurrent then + EgtMdbSetCurrMachining( sCutting) + else + EgtMdbSetCurrMachining( sCuttingDn) + end + bIsCurrentBladeCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0 + bIsCurrentMachiningInverted = EgtMdbGetCurrMachiningParam( MCH_MP.INVERT) + + -- imposto la direzione di lavoro per avere scarico del truciolo ottimale + local nWorkSide, bInvert + if not bIsTopBladeCurrent and abs( nSide) ~= 2 then + if bIsCurrentBladeCW then + nWorkSide = MCH_MILL_WS.LEFT + bInvert = true + else + nWorkSide = MCH_MILL_WS.RIGHT + bInvert = false + end + else + if bIsCurrentBladeCW then + nWorkSide = MCH_MILL_WS.LEFT + bInvert = false + else + nWorkSide = MCH_MILL_WS.RIGHT + bInvert = true + end + end + + -- imposto eventuale inversione di estensioni e accorciamenti + if bIsCurrentMachiningInverted ~= bInvert then + dSal, dEal = dEal, dSal + end + + -- setto la lavorazione con i valori calcolati + EgtSetMachiningParam( MCH_MP.INVERT, bInvert) + EgtSetMachiningParam( MCH_MP.WORKSIDE, nWorkSide) + EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUseCurrent) + + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal) -- imposto offset radiale diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index 3a3084b..5ff9e83 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -14,6 +14,7 @@ -- 2023/01/27 In MakeSideFace il prolungamento di uscita รจ ora fissato a 10 mm. -- 2023/02/15 Migliorato verso di avanzamento della lama. -- 2023/02/21 Verso di avanzamento della lama migliorato anche con lama LC. +-- 2023/02/22 Nuova gestione del verso di avanzamento ottimale che contempla tutti i casi. -- Tabella per definizione modulo local ProcessLong2Cut = {} @@ -689,36 +690,88 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster if ( not bFront and k == 1) or ( bFront and k == 2) then dSal, dEal = dEal, dSal end - if bCanUseBlade and bCanUseUnderBlade then - if bCanUseBlade and nSide == -1 then - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse)) + + + -- verifico lama in uso e imposto uso faccia + local bIsTopBladeCurrent + local nFaceUseCurrent + if bCanUseBlade and bCanUseUnderBlade then + if nSide == -1 then + if k == 1 then + bIsTopBladeCurrent = true + nFaceUseCurrent = nFaceUse2 else - EgtSetMachiningParam( MCH_MP.INVERT, true) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2)) + bIsTopBladeCurrent = false + nFaceUseCurrent = nFaceUse end - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2)) - elseif bCanUseUnderBlade then - if nSide ~= 0 then - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) - end - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2)) else - if bCanUseBlade and nSide == -1 then - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + if k == 1 then + bIsTopBladeCurrent = false + nFaceUseCurrent = nFaceUse else - EgtSetMachiningParam( MCH_MP.INVERT, false) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) - dSal, dEal = dEal, dSal + bIsTopBladeCurrent = true + nFaceUseCurrent = nFaceUse2 end - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2)) end + elseif bCanUseUnderBlade then + if k == 1 then + bIsTopBladeCurrent = false + nFaceUseCurrent = nFaceUse + else + bIsTopBladeCurrent = false + nFaceUseCurrent = nFaceUse2 + end + else + if k == 1 then + bIsTopBladeCurrent = true + nFaceUseCurrent = nFaceUse + else + bIsTopBladeCurrent = true + nFaceUseCurrent = nFaceUse2 + end + end + + -- recupero alcune informazioni utili dalla lavorazione attuale + local bIsCurrentBladeCW + local bIsCurrentMachiningInverted + if bIsTopBladeCurrent then + EgtMdbSetCurrMachining( sCutting) + else + EgtMdbSetCurrMachining( sCuttingDn) + end + bIsCurrentBladeCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0 + bIsCurrentMachiningInverted = EgtMdbGetCurrMachiningParam( MCH_MP.INVERT) + + -- imposto la direzione di lavoro per avere scarico del truciolo ottimale + local nWorkSide, bInvert + if ( not bIsTopBladeCurrent and abs( nSide) ~= 0) or ( bCanUseBlade and bCanUseUnderBlade and nSide == -1) then + if bIsCurrentBladeCW then + nWorkSide = MCH_MILL_WS.LEFT + bInvert = true + else + nWorkSide = MCH_MILL_WS.RIGHT + bInvert = false + end + else + if bIsCurrentBladeCW then + nWorkSide = MCH_MILL_WS.LEFT + bInvert = false + else + nWorkSide = MCH_MILL_WS.RIGHT + bInvert = true + end + end + + -- imposto eventuale inversione di estensioni e accorciamenti + if bIsCurrentMachiningInverted ~= bInvert then + dSal, dEal = dEal, dSal + end + + -- setto la lavorazione con i valori calcolati + EgtSetMachiningParam( MCH_MP.INVERT, bInvert) + EgtSetMachiningParam( MCH_MP.WORKSIDE, nWorkSide) + EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUseCurrent) + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)