From 33d70bdbf49a9bef97ac5e6c6fab94c8640defe5 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 25 Nov 2022 16:46:39 +0100 Subject: [PATCH 1/3] BugFix/FixLongCut: - in LongCut per lavorazioni con fresa su F2 e F4 si esclude la testa 3 per evitare problemi di finecorsa --- LuaLibs/MachiningLib.lua | 14 ++++++++------ LuaLibs/ProcessLongCut.lua | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 8d1bc16..b4faff5 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -3,6 +3,7 @@ -- 2022/05/07 ES Profonde modifiche per scelta ottimale lavorazioni in macchine con più teste. -- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati -- 2022/11/02 Modificata scelta utensile ottimizzata. Ora se c'è un utensile più grande disponibile si dà preferenza a quello. +-- 2022/11/25 Per FindMilling implementata la possibilità di escludere la testa H3 dalla ricerca utensile. -- Tabella per definizione modulo local MachiningLib = {} @@ -108,8 +109,9 @@ local function SetCurrMachiningAndTool( sMachName) local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD) local nHead = tonumber( sHead:sub( 2, #sHead)) local bH2 = ( nHead >= 21 and nHead <= 29) + local bH3 = ( nHead >= 31 and nHead <= 39) local bFixed = ( vFixedHeads[nHead]) - return bActive, sTool, bH2, bFixed + return bActive, sTool, bH2, bFixed, bH3 end --------------------------------------------------------------------- @@ -222,7 +224,7 @@ function ReturnParams( MachiningType, MachiningName, sType, ToolParams) end --------------------------------------------------------------------- -local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead) +local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH3) if bTopHead == nil and bDownHead == nil then bTopHead = true bDownHead = false @@ -273,8 +275,8 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead) _, sMachiningType = EgtEndsWith( Machining.Type, '_H2') end -- recupero dati utensile - local bToolActive, sToolName, bH2, bFixed = SetCurrMachiningAndTool( Machining.Name) - if Machining.On and sMachiningType == sType and bToolActive then + local bToolActive, sToolName, bH2, bFixed, bH3 = SetCurrMachiningAndTool( Machining.Name) + if Machining.On and sMachiningType == sType and bToolActive and ( not bH3 or bH3 == not bExcludeH3) then local bOk, ToolParams = VerifyTool( MachiningType, sType, Params, bH2) if bOk then if MachineHeadUse == ONE_HEAD then @@ -384,8 +386,8 @@ function MachiningLib.FindAngleDrilling( dDiam, dDepth, bTopHead, bDownHead) end --------------------------------------------------------------------- -function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead) - return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead) +function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH3) + return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH3) end --------------------------------------------------------------------- diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index d47bc00..f72e26b 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -860,7 +860,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- recupero la lavorazione local bDownHead = ( nSide == - 1) sMchType = EgtIf( bDownHead, 'Long2Cut_H2', 'Long2Cut') - local sMilling = ML.FindMilling( sMchType, dElev, nil, nil, nil, not bDownHead, bDownHead) + local bExcludeH3 = bLarghAsFace and abs( nSide) ~= 1 + local sMilling = ML.FindMilling( sMchType, dElev, nil, nil, nil, not bDownHead, bDownHead, bExcludeH3) if not sMilling then local sErr = 'Error : milling '..sMchType..' not found in library' EgtOutLog( sErr) From c8b5f9ca27b59df071e2703edc6c6902355e68d3 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 28 Nov 2022 09:52:01 +0100 Subject: [PATCH 2/3] BugFix/FixLongCut: - aggiustato l'attacco in caso di inizio/fine limitate --- LuaLibs/ProcessLongCut.lua | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index f72e26b..6b0f2de 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -886,11 +886,22 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus if bLimXmin and bLimXmax and Proc.Box:getDimX() < 2 * dToolDiam then return MakeByPocketing( Proc, nPhase, nRawId, nPartId) end + -- determino l'utilizzo della faccia + local nFaceUse = EgtIf( abs( vtN:getY()) > 0.01, MCH_MILL_FU.ORTHO_DOWN, EgtIf( bFront, MCH_MILL_FU.ORTHO_FRONT, MCH_MILL_FU.ORTHO_BACK)) + -- determino il lato di attacco (0:xMin, 1:xMax) + local nStartSide = 0 + if nFaceUse == MCH_MILL_FU.ORTHO_DOWN and not bFront then + nStartSide = 1 + elseif nFaceUse ~= MCH_MILL_FU.ORTHO_DOWN then + if ( bFront and nSide == -1) or ( not bFront and nSide == 1) then + nStartSide = 1 + end + end -- determino gli estremi local dStartDist = 0 local dStartAccDist = BD.LONGCUT_ENDLEN local bStartFixed = true - if ( bLimXmin and bFront) or ( bLimXmax and not bFront) then + if ( bLimXmin and nStartSide == 0) or ( bLimXmax and nStartSide == 1) then dStartDist = dToolDiam / 2 dStartAccDist = BD.LONGCUT_MAXLEN bStartFixed = false @@ -898,7 +909,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus local dEndDist = 0 local dEndAccDist = BD.LONGCUT_ENDLEN local bEndFixed = true - if ( bLimXmin and not bFront) or ( bLimXmax and bFront) then + if ( bLimXmin and nStartSide == 1) or ( bLimXmax and nStartSide == 0) then dEndDist = dToolDiam / 2 dEndAccDist = BD.LONGCUT_MAXLEN bEndFixed = false @@ -963,8 +974,6 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus dEndAccDist = 0 end end - -- determino l'utilizzo della faccia - local nFaceUse = EgtIf( abs( vtN:getY()) > 0.01, MCH_MILL_FU.ORTHO_DOWN, EgtIf( bFront, MCH_MILL_FU.ORTHO_FRONT, MCH_MILL_FU.ORTHO_BACK)) -- si percorre il lato basso della faccia local nM = 0 local nCountMilHead = 0 @@ -995,6 +1004,21 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus EgtOutLog( sErr) return false, sErr end + if i == 1 and not bStartFixed then + if nO == 1 or EgtGetMachiningParam( MCH_MP.LITANG) ~= 0 then + EgtSetMachiningParam( MCH_MP.LIELEV, 0) + EgtSetMachiningParam( MCH_MP.LITANG, 0) + EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR) + EgtSetMachiningParam( MCH_MP.LIPERP, dWidth + BD.CUT_EXTRA + BD.CUT_SIC or 20) + end + elseif i == nC and not bEndFixed then + if nO == 1 or EgtGetMachiningParam( MCH_MP.LOTANG) ~= 0 then + EgtSetMachiningParam( MCH_MP.LOELEV, 0) + EgtSetMachiningParam( MCH_MP.LOTANG, 0) + EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.LINEAR) + EgtSetMachiningParam( MCH_MP.LOPERP, dWidth + BD.CUT_EXTRA + BD.CUT_SIC or 20) + end + end -- aggiungo geometria EgtSetMachiningGeometry( {{ Proc.Id, 0}}) -- limito opportunamente la lavorazione From 58ea4361323a227c172d07cf26c5d3075a3b8c31 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 28 Nov 2022 12:28:22 +0100 Subject: [PATCH 3/3] BugFix/FixLongCut: - corrette le passate di pulizia che venivano omesse in alcuni casi --- LuaLibs/ProcessLongCut.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index 6b0f2de..739320f 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -13,6 +13,7 @@ -- 2022/07/14 Aggiunta limitazione lavorazione a sinistra anche se il grezzo successivo non ha lavorazioni (finale barra) ma è abbastanza lungo da poter essere riutilizzato (BD.MinRaw). -- 2022/09/23 Modificato l'angolo per l'abilitazione della lama da sotto: ora interviene anche per facce verticali. -- 2022/11/04 Aggiunto passaggio parametro bDownHead (Testa da Sotto) nelle chiamate a MakeSideFace. +-- 2022/11/28 Correzioni varie per attacco, pulizia spigoli, utilizzo H3 -- Tabella per definizione modulo local ProcessLongCut = {} @@ -1004,6 +1005,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus EgtOutLog( sErr) return false, sErr end + -- correggo l'attacco se necessario if i == 1 and not bStartFixed then if nO == 1 or EgtGetMachiningParam( MCH_MP.LITANG) ~= 0 then EgtSetMachiningParam( MCH_MP.LIELEV, 0) @@ -1047,7 +1049,11 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus end -- eventuale lavorazione della faccia limitante l'inizio if i == 1 and not bStartFixed then - local vtIni = EgtIf( bFront, X_AX(), -X_AX()) + -- per il lato sotto il vettore è opposto + local vtIni = EgtIf( bFront, X_AX(), -X_AX()) + if nSide == -1 then + vtIni = -1 * vtIni + end for j = 1, Proc.Fct - 1 do local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT) if vtIni * vtN > 0 and nCountMilHead < 2 then @@ -1064,7 +1070,11 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- eventuale lavorazione della faccia limitante la fine if not bEndFixed then - local vtFin = EgtIf( bFront, -X_AX(), X_AX()) + -- per il lato sotto il vettore è opposto + local vtFin = EgtIf( bFront, -X_AX(), X_AX()) + if nSide == -1 then + vtFin = -1 * vtFin + end for j = 1, Proc.Fct - 1 do local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT) if vtFin * vtN > 0 and nCountMilHead < 2 then