From eeb34638cf981433e92a4983c6599a35eb534586 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 26 May 2023 18:12:53 +0200 Subject: [PATCH 1/3] - da testare funzionamento corretto - da implementare step verticali --- LuaLibs/WProcessFreeContour.lua | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 1c3c0a7..df6a386 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -67,6 +67,7 @@ function WPF.Classify( Proc, b3Raw) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) -- recupero il tipo di lavorazione local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0 + local nTool_ID = EgtGetInfo( Proc.Id, 'CNT_DATA', 'i') or 0 -- se tasca if bPocket then -- cerco la faccia di fondo della superfice (deve avere direzione circa quella di estrusione della curva) @@ -87,10 +88,10 @@ function WPF.Classify( Proc, b3Raw) -- se penna o chiodatura va sempre bene (vengono sempre riportati sopra) elseif nCntType == 10 or nCntType == 20 then return true - -- se altrimenti profilo verticale che non interessa tutta la sezione - elseif Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() - 2 then + -- se altrimenti profilo verticale che non interessa tutta la sezione e non caso speciale con lamatura affondata + elseif ( Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() - 2) and ( ( not nTool_ID == WD.RECESSED_COUNTERBORE_TOOLID) or ( not EgtCurveIsACircle( AuxId))) then return false - -- altrimenti è profilo verticale che interessa tutta la sezione + -- altrimenti è profilo verticale che interessa tutta la sezione o caso speciale con lamatura affondata else return true end @@ -2185,6 +2186,25 @@ local function MakeByMill( Proc, nRawId, b3Raw) elseif ( Proc.Grp == 3 and bToolInv) or ( Proc.Grp == 4 and not bToolInv) then EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) end + -- se lamatura affondata speciale, setto attacco e stacco al centro + local bIsRecessedCounterBore = ( Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() - 10 * GEO.EPS_SMALL) and + ( nTool_ID == WD.RECESSED_COUNTERBORE_TOOLID) and + ( EgtCurveIsACircle( AuxId)) + if bIsRecessedCounterBore then + local _, _, _, dContourRadius = EgtCurveIsACircle( AuxId) + -- setto attacco + EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.TANGENT) + EgtSetMachiningParam( MCH_MP.STARTADDLEN, 0) + EgtSetMachiningParam( MCH_MP.LITANG, 0) + EgtSetMachiningParam( MCH_MP.LIPERP, dContourRadius - 0.5 * dMillDiam) + EgtSetMachiningParam( MCH_MP.LIELEV, 0) + -- setto stacco + EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.LINEAR) + EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0) + EgtSetMachiningParam( MCH_MP.LOTANG, 0) + EgtSetMachiningParam( MCH_MP.LOPERP, dContourRadius - 0.5 * dMillDiam) + EgtSetMachiningParam( MCH_MP.LOELEV, 0) + end -- posizione braccio porta testa local nSCC = MCH_SCC.ADIR_ZP if AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then From d020fa143c4e76716cbc7834cb17024abf5a2f2a Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 29 May 2023 18:01:59 +0200 Subject: [PATCH 2/3] - aggiunta gestione step verticale - correzioni minori --- LuaLibs/WProcessFreeContour.lua | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index df6a386..17a2fd2 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -89,7 +89,7 @@ function WPF.Classify( Proc, b3Raw) elseif nCntType == 10 or nCntType == 20 then return true -- se altrimenti profilo verticale che non interessa tutta la sezione e non caso speciale con lamatura affondata - elseif ( Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() - 2) and ( ( not nTool_ID == WD.RECESSED_COUNTERBORE_TOOLID) or ( not EgtCurveIsACircle( AuxId))) then + elseif ( Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() - 2) and ( ( not nTool_ID == ( WD.RECESSED_COUNTERBORE_TOOLID or 0)) or ( not EgtCurveIsACircle( AuxId))) then return false -- altrimenti è profilo verticale che interessa tutta la sezione o caso speciale con lamatura affondata else @@ -101,8 +101,8 @@ end -- Classificazione del flip della feature per nesting -- return nFlip0, nFlip1 function WPF.FlipClassify( Proc, b3Raw) - local nFlip0 = 0 - local nFlip1 = 0 + local nFlip0 = 0 + local nFlip1 = 0 -- verifico se di tipo pocket local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1) @@ -2187,8 +2187,8 @@ local function MakeByMill( Proc, nRawId, b3Raw) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) end -- se lamatura affondata speciale, setto attacco e stacco al centro - local bIsRecessedCounterBore = ( Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() - 10 * GEO.EPS_SMALL) and - ( nTool_ID == WD.RECESSED_COUNTERBORE_TOOLID) and + local bIsRecessedCounterBore = ( Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() + 10 * GEO.EPS_SMALL) and + ( nTool_ID == WD.RECESSED_COUNTERBORE_TOOLID or 0) and ( EgtCurveIsACircle( AuxId)) if bIsRecessedCounterBore then local _, _, _, dContourRadius = EgtCurveIsACircle( AuxId) @@ -2204,6 +2204,16 @@ local function MakeByMill( Proc, nRawId, b3Raw) EgtSetMachiningParam( MCH_MP.LOTANG, 0) EgtSetMachiningParam( MCH_MP.LOPERP, dContourRadius - 0.5 * dMillDiam) EgtSetMachiningParam( MCH_MP.LOELEV, 0) + -- imposto step + local dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or 0 + local dStep = EgtGetMachiningParam( MCH_MP.STEP) + if dStep < GEO.EPS_SMALL then dStep = 0.75 * dMaxMat end + local nStep = ceil( ( dDepth - dMaxMat) / dStep) + dStep = max( ( dDepth - dMaxMat) / max( nStep, 1), 0) + local dMaxElev = max( ( nStep + 1) * dStep - GEO.EPS_SMALL, 0) + EgtSetMachiningParam( MCH_MP.STEP, dStep) + -- imposto elevazione + EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';') end -- posizione braccio porta testa local nSCC = MCH_SCC.ADIR_ZP From b0b8e88c30c639343f2929b1d5a07ea6404be43f Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 6 Jun 2023 12:54:35 +0200 Subject: [PATCH 3/3] - Alcune correzioni minori - Sistemati commenti --- LuaLibs/WProcessFreeContour.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 17a2fd2..1a08ea3 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -19,6 +19,7 @@ -- 2023/04/14 Aggiunta pulitura spigoli Q05=1 anche su sole fresature. -- 2023/04/17 Lavorazione CleanCorner sempre forzata con lato di lavoro in centro. -- 2023/05/25 Funzioni EgtAddMachining sostituite da WM.AddMachining in modo da trascrivere le priorità da btl alle lavorazioni. +-- 2023/06/06 Aggiunta gestione lavorazione per lamatura speciale affondata con Tool_ID specifico. -- Tabella per definizione modulo local WPF = {} @@ -67,7 +68,7 @@ function WPF.Classify( Proc, b3Raw) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) -- recupero il tipo di lavorazione local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0 - local nTool_ID = EgtGetInfo( Proc.Id, 'CNT_DATA', 'i') or 0 + local nTool_ID = EgtGetInfo( Proc.Id, 'CNT_DATA', 'i') -- se tasca if bPocket then -- cerco la faccia di fondo della superfice (deve avere direzione circa quella di estrusione della curva) @@ -89,7 +90,7 @@ function WPF.Classify( Proc, b3Raw) elseif nCntType == 10 or nCntType == 20 then return true -- se altrimenti profilo verticale che non interessa tutta la sezione e non caso speciale con lamatura affondata - elseif ( Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() - 2) and ( ( not nTool_ID == ( WD.RECESSED_COUNTERBORE_TOOLID or 0)) or ( not EgtCurveIsACircle( AuxId))) then + elseif ( Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() - 2) and ( not nTool_ID or ( nTool_ID ~= ( WD.RECESSED_COUNTERBORE_TOOLID or 0)) or ( not EgtCurveIsACircle( AuxId))) then return false -- altrimenti è profilo verticale che interessa tutta la sezione o caso speciale con lamatura affondata else @@ -2186,6 +2187,7 @@ local function MakeByMill( Proc, nRawId, b3Raw) elseif ( Proc.Grp == 3 and bToolInv) or ( Proc.Grp == 4 and not bToolInv) then EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) end + -- se lamatura affondata speciale, setto attacco e stacco al centro local bIsRecessedCounterBore = ( Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() + 10 * GEO.EPS_SMALL) and ( nTool_ID == WD.RECESSED_COUNTERBORE_TOOLID or 0) and @@ -2215,6 +2217,7 @@ local function MakeByMill( Proc, nRawId, b3Raw) -- imposto elevazione EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';') end + -- posizione braccio porta testa local nSCC = MCH_SCC.ADIR_ZP if AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then