From e6c173e5a1f4627969153f7160108690c8ad9a8d Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 27 Sep 2022 11:32:26 +0200 Subject: [PATCH] =?UTF-8?q?Improvement/BetterMortiseToolSelection:=20-Migl?= =?UTF-8?q?iorata=20la=20scelta=20utensile.=20Se=20c'=C3=A8=20almeno=20una?= =?UTF-8?q?=20lavorazione=20'mortise'=20si=20cerca=20di=20usare=20quelle,?= =?UTF-8?q?=20riducendo=20l'elevazione=20se=20necessario.=20Se=20non=20c'?= =?UTF-8?q?=C3=A8=20nemmeno=20una=20lavorazione=20'mortise'=20si=20passa?= =?UTF-8?q?=20alle=20pocket.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/ProcessMortise.lua | 39 ++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/LuaLibs/ProcessMortise.lua b/LuaLibs/ProcessMortise.lua index b1c0db6..67e2854 100644 --- a/LuaLibs/ProcessMortise.lua +++ b/LuaLibs/ProcessMortise.lua @@ -4,6 +4,8 @@ -- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda). -- 2022/07/26 Aggiunta gestione del parametro P04=1 per la pulizia degli angoli con mortasatrice (sega a catena) specifica -- 2022/07/29 Nella pulitura angoli aggiunto il check dimensioni tasca vs utensile. Corretta direzione utensile per mortasa frontale. +-- 2022/09/27 Migliorata la scelta utensile. Se c'è almeno una lavorazione 'mortise' si cerca di usare quelle, riducendo l'elevazione se necessario. +-- Se non c'è nemmeno una lavorazione 'mortise' si passa alle pocket. -- Tabella per definizione modulo local ProcessMortise = {} @@ -229,6 +231,35 @@ local function CleanCorners( Proc, dMorH, vtN, bDoubleDir, AuxId) return true, sWarn end +--------------------------------------------------------------------- +local function VerifyMortiseOrPocket( Proc, dDiam, dDepth, dMaxTotLen, sType, bPocketDown) + -- ricerca della svuotatura + local sPocketing + if dDepth then + sPocketing = ML.FindPocketing( sType, dDiam, dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or + ML.FindPocketing( sType, dDiam, 0.8 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or + ML.FindPocketing( sType, dDiam, 0.6 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or + ML.FindPocketing( sType, dDiam, 0.4 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or + ML.FindPocketing( sType, dDiam, 0, dMaxTotLen) + else + sPocketing = ML.FindPocketing( sType, dDiam, 0, dMaxTotLen) + end + if not sPocketing then + return false + end + -- recupero i dati dell'utensile + local dMaxDepth = 0 + local dToolDiam = 0 + if EgtMdbSetCurrMachining( sPocketing) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam + dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth + end + end + return sPocketing, dMaxDepth, dToolDiam +end + --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) @@ -387,16 +418,16 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end local sPocketing if Proc.Prc ~= 53 then - sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown) + sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown) if not sPocketing and bPockUp then - sPocketing = ML.FindPocketing( sPockType, dW) + sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt) end end if not sPocketing then sPockType = 'Pocket' - sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown) + sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown) if not sPocketing and bPockUp then - sPocketing = ML.FindPocketing( sPockType, dW) + sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt) end end if not sPocketing then