From 0d5e2737e404968966bf5b4e727f347f3050374c Mon Sep 17 00:00:00 2001 From: DarioS Date: Wed, 21 Dec 2022 09:42:33 +0100 Subject: [PATCH] DataBeam : - su Tenoni aggiunta gestione smusso, migliorata scelta tra sopra e sotto per il punto di inizio e in VerifyOrientation aggiunta trave medio alta - su SawCut aggiunta gestione testa da sotto - su Cut allargati i limiti di lunghezza per tagli verticali inclinati di fianco. --- LuaLibs/ProcessCut.lua | 8 ++--- LuaLibs/ProcessSawCut.lua | 13 ++++++--- LuaLibs/ProcessTenon.lua | 61 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 70 insertions(+), 12 deletions(-) diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 4e89599..1684f3a 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -1,4 +1,4 @@ --- ProcessCut.lua by Egaltech s.r.l. 2022/09/30 +-- ProcessCut.lua by Egaltech s.r.l. 2022/12/19 -- Gestione calcolo singoli tagli di lama per Travi -- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito. -- 2021/06/06 Correzioni per tagli con testa da sotto. @@ -284,9 +284,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b -- se la faccia occupa tutta la trave in X e Z o occupa sicuramente la faccia in Z e almeno 3/4 della faccia in X e sborda in X, if ( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) or ( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) and - Proc.Box:getDimX() > 0.75 * b3Solid:getDimX())) and + Proc.Box:getDimX() > 0.90 * b3Solid:getDimX())) and abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL then - local sErr = 'Error : Impossible to machine by orientation (on side)' + local sErr = 'Error : Impossible to machine by orientation (on side A)' EgtOutLog( sErr) return false, sErr end @@ -304,7 +304,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b -- se la faccia termina davanti o dietro la trave e arriva in coda e non interessa la faccia inferiore, forzo il taglio a cubetti a partire dal davanti if ( abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL) and abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL then - local sErr = 'Error : Impossible to machine by orientation (on side)' + local sErr = 'Error : Impossible to machine by orientation (on side B)' EgtOutLog( sErr) return false, sErr end diff --git a/LuaLibs/ProcessSawCut.lua b/LuaLibs/ProcessSawCut.lua index 6e3bab3..809ab39 100644 --- a/LuaLibs/ProcessSawCut.lua +++ b/LuaLibs/ProcessSawCut.lua @@ -1,6 +1,7 @@ --- ProcessSawCut.lua by Egaltech s.r.l. 2022/03/07 +-- ProcessSawCut.lua by Egaltech s.r.l. 2022/12/19 -- Gestione calcolo taglio di lama per Travi --- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe) +-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe). +-- 2022/12/19 Aggiunta gestione testa da sotto. -- Tabella per definizione modulo local ProcessSawCut = {} @@ -80,8 +81,12 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) end -- recupero flag per inizio e fine interni local bInside = (( EgtGetInfo( Proc.Id, 'Q01', 'i') or 0) ~= 0) + -- abilitazione lavorazione da sotto + local bDownHead = ( BD.DOWN_HEAD and vtDir:getZ() < -0.341) + local bTopHead = ( BD.DOWN_HEAD and ( vtDir:getZ() > -0.342 or not bDownHead)) -- recupero la lavorazione - local sCutting = ML.FindCutting( 'HeadSide') + local sCutting + sCutting, bDownHead = ML.FindCutting( 'HeadSide', bTopHead, bDownHead) if not sCutting then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library' EgtOutLog( sErr) @@ -101,7 +106,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) end -- determino se lavorazione da davanti o da dietro e se da sotto local bFront = ( vtDir ^ vtN):getX() > 0 - local bDownUp = ( vtN:getZ() < -0.259) + local bDownUp = ( not bDownHead and vtN:getZ() < -0.259) local bFillAreaPiece -- se non da sotto if not bDownUp then diff --git a/LuaLibs/ProcessTenon.lua b/LuaLibs/ProcessTenon.lua index 93acbd4..52816b4 100644 --- a/LuaLibs/ProcessTenon.lua +++ b/LuaLibs/ProcessTenon.lua @@ -1,4 +1,4 @@ --- ProcessTenon.lua by Egaltech s.r.l. 2022/12/12 +-- ProcessTenon.lua by Egaltech s.r.l. 2022/12/20 -- Gestione calcolo tenone per Travi -- 2021/10/04 Corretto calcolo HCING per pezzi piccoli. -- 2022/02/15 Aggiornata VerifyOrientation per macchine con testa da sotto. @@ -7,6 +7,7 @@ -- 2022/09/20 Migliorato il calcolo delle passate laterali; ora considera la reale distanza tra contorno del tenone e estremi della faccia -- 2022/11/03 Corretto uso di bH2 (da sotto solo se anche bMillDown vero). -- 2022/12/12 Su macchine con rulli pressori e pinze separate si riduce di meno l'ingombro con tenoni inclinati. +-- 2022/12/20 Aggiunta gestione smusso. Migliorata scelta tra sopra e sotto per il punto di inizio. In VerifyOrientation aggiunta trave medio alta. -- Tabella per definizione modulo local ProcessTenon = {} @@ -32,8 +33,8 @@ local function VerifyOrientation( Proc, vtN, b3Raw) end -- se trave molto bassa if b3Raw:getDimZ() <= 120 then - -- se tenone praticamente in asse, accetto fino a -45 deg - if abs( vtN:getY()) < 0.04 then + -- se non testa PF e tenone praticamente in asse, accetto fino a -45 deg + if not BD.C_SIMM and abs( vtN:getY()) < 0.04 then return ( vtN:getZ() >= -0.7072) -- altrimenti accetto fino a -30deg else @@ -57,6 +58,15 @@ local function VerifyOrientation( Proc, vtN, b3Raw) else return ( vtN:getZ() >= -0.174) end + -- se trave medio alta + elseif b3Raw:getDimZ() <= 400 then + -- se tenone praticamente in asse, accetto fino a -15 deg + if abs( vtN:getY()) < 0.04 then + return ( vtN:getZ() >= -0.259) + -- altrimenti, accetto fino a -5 deg + else + return ( vtN:getZ() >= -0.088) + end -- altrimenti else -- accetto fino a -5deg @@ -197,6 +207,43 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end end end + -- se vero tenone e richiesto, eseguo lo smusso + if Proc.Prc ~= 52 and EgtGetInfo( Proc.Id, 'P05', 'i') == 1 then + -- profondità smusso + local dDepth = EgtGetInfo( Proc.Id, 'Q01', 'd') or 0 + if dDepth > 0.1 then + local dExtra = 2 + -- recupero la lavorazione + local sMilling = ML.FindMilling( 'Mark', nil, nil, nil, nil, bMillUp, bMillDown) + if not sMilling then + local sErr = 'Error : milling (Mark) not found in library' + EgtOutLog( sErr) + return false, sErr + end + -- Inserisco la lavorazione + local sName1 = 'TenC_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMch1Id = EgtAddMachining( sName1, sMilling) + if not nMch1Id then + local sErr = 'Error adding machining ' .. sName1 .. '-' .. sMilling + EgtOutLog( sErr) + return false, sErr + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- assegno affondamento e offset radiale + EgtSetMachiningParam( MCH_MP.DEPTH, -dTenH + dDepth + dExtra) + EgtSetMachiningParam( MCH_MP.OFFSR, dExtra) + EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDepth + dExtra, 1) .. ';') + -- assegno lato di lavoro + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchId, false) + return false, sErr + end + end + end -- recupero la lavorazione local sMillType = 'Tenon' local sMilling, _, _, bH2 = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown) @@ -226,8 +273,14 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) local OVERLAP_COEFF = 0.7 -- porto inizio curva il più possibile sul bordo in alto o in basso local dMaxDist = OVERLAP_COEFF * dMillDiam * MAX_PASS + local bFromBottom local bMyShortPart = ( bShortPart and vtN:getX() < 0 and abs( vtN:getX()) < 0.999 and abs( vtN:getY()) < 0.259) - BL.PutStartNearestToEdge( AuxId, b3Solid, dMaxDist, EgtIf( bH2 and bMillDown, not bMyShortPart, bMyShortPart)) + if bH2 and bMillDown then + bFromBottom = EgtIf( bMyShortPart and vtN:getZ() < -0.018, false, true) + else + bFromBottom = EgtIf( bMyShortPart and vtN:getZ() > 0.018, true, false) + end + BL.PutStartNearestToEdge( AuxId, b3Solid, dMaxDist, bFromBottom) -- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente local sWarn local dDepth = 0