diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 1c3c0a7..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,6 +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') -- se tasca if bPocket then -- cerco la faccia di fondo della superfice (deve avere direzione circa quella di estrusione della curva) @@ -87,10 +89,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 or ( nTool_ID ~= ( WD.RECESSED_COUNTERBORE_TOOLID or 0)) 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 @@ -100,8 +102,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) @@ -2185,6 +2187,37 @@ 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 + ( 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) + -- 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 if AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then