From 03f1a222e14bc041d761dfb414ad7d712b67d971 Mon Sep 17 00:00:00 2001 From: DarioS Date: Thu, 27 Jan 2022 09:01:47 +0100 Subject: [PATCH] DataBeam : - migliorie per gestire meglio lavorazioni su macchine con teste da sotto. --- LuaLibs/ProcessCut.lua | 7 +++--- LuaLibs/ProcessLapJoint.lua | 38 ++++++++++++++++++++----------- LuaLibs/ProcessProfCamb.lua | 10 ++++---- LuaLibs/ProcessStepJoint.lua | 10 ++++++-- LuaLibs/ProcessStepJointNotch.lua | 17 ++++++++++---- 5 files changed, 54 insertions(+), 28 deletions(-) diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index e8095e0..f120cce 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -1,10 +1,11 @@ --- ProcessCut.lua by Egaltech s.r.l. 2021/11/27 +-- ProcessCut.lua by Egaltech s.r.l. 2022/01/26 -- 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. -- 2021/07/14 Migliorie per tagli con testa da sotto. -- 2021/09/19 Tagli da sotto non sbiechi favorita posizione da sopra di testa. -- 2021/10/06 Piccola correzione a tagli di cubetti con testa da sotto. +-- 2022/01/26 Taglio da sotto orizzontale deve avere direzione di riferimento ortogonale -Z. -- Tabella per definizione modulo local ProcessCut = {} @@ -589,7 +590,7 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead) vtOrthoO_2 = Vector3d( vtO) * EgtIf( bOrthInv, -1, 1) else if bHorizCut then - vtOrthoO_2 = Z_AX() + vtOrthoO_2 = -Z_AX() elseif vtN:getY() > -0.02 then if not Proc.Head then vtOrthoO_2 = -Y_AX() @@ -637,7 +638,7 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead) -- lavoro la faccia local vtOrthoO if bHorizCut and ( b3Solid:getDimX() > BD.LEN_SHORT_PART or vtN:getX() > 0) then - vtOrthoO = Z_AX() + vtOrthoO = -Z_AX() elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and abs( vtN:getY()) > 0.259 and vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then if Proc.Head then vtOrthoO = X_AX() diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 19165c7..444b581 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2022/01/19 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/01/26 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. -- 2021/01/24 Con sega a catena ora sempre impostato asse A. @@ -33,6 +33,7 @@ -- 2021/11/15 Quando si usa sega a catena uso Q10 come massima elevazione. -- 2021/11/22 Corretta segnalazione warning su foro di L20 e L25. -- 2022/01/19 Cambiata % lunghezza pezzo per spezzatura. Tolta correzione spessore fresa a disco con superficie da lavorare verso Z-. +-- 2022/01/26 Migliorato controllo uso testa da sotto nel caso due facce con lama. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -5338,6 +5339,23 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) return true, sWarn end +--------------------------------------------------------------------- +local function TestTwoFacesDownHead( Proc) + -- verifico ci siano due facce + if Proc.Fct ~= 2 then return false end + -- verifico se da lavorare con testa da sotto + local bDownHead = false + if BD.DOWN_HEAD then + local ptC = {} + local vtN = {} + ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) + ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT) + local vtNm = ( vtN[1] + vtN[2]) ; vtNm:normalize() + bDownHead = ( vtNm:getZ() < -0.5) + end + return bDownHead +end + --------------------------------------------------------------------- -- Applicazione della lavorazione --------------------------------------------------------------------- @@ -5403,6 +5421,8 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- due facce elseif Proc.Fct == 2 then + -- verifico se da lavorare con testa da sotto + local bDownHead = TestTwoFacesDownHead( Proc) -- determino se due facce lunghe oppure una lunga e l'altra terminale local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 0, GDB_BB.STANDARD) local b3Fac2 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 1, GDB_BB.STANDARD) @@ -5418,7 +5438,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) if nForceUseBladeOnNotContinueFace and nForceUseBladeOnNotContinueFace > 0 then return LongCut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nForceUseBladeOnNotContinueFace) else - return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide') + return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead) end else return LongCut.Make( Proc, nPhase, nRawId, nPartId) @@ -5428,14 +5448,14 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) if nForceUseBladeOnNotContinueFace and nForceUseBladeOnNotContinueFace > 0 then return LongCut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nForceUseBladeOnNotContinueFace) else - return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide') + return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead) end else return LongCut.Make( Proc, nPhase, nRawId, nPartId) end else if bUseBlade then - return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide') + return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead) else return MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) end @@ -5489,15 +5509,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- altrimenti else -- verifico se da lavorare con testa da sotto - local bDownHead = false - if BD.DOWN_HEAD then - local ptC = {} - local vtN = {} - ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) - ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT) - local vtNm = ( vtN[1] + vtN[2]) ; vtNm:normalize() - bDownHead = ( vtNm:getZ() < -0.5) - end + local bDownHead = TestTwoFacesDownHead( Proc) -- determino l'angolo tra le facce local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) -- se ortogonali e non forzata lama oppure con testa da sotto, con fresa diff --git a/LuaLibs/ProcessProfCamb.lua b/LuaLibs/ProcessProfCamb.lua index 54107c2..9f17dbe 100644 --- a/LuaLibs/ProcessProfCamb.lua +++ b/LuaLibs/ProcessProfCamb.lua @@ -1,9 +1,10 @@ --- ProcessProfCamb.lua by Egaltech s.r.l. 2021/11/09 +-- ProcessProfCamb.lua by Egaltech s.r.l. 2022/01/26 -- Gestione calcolo profilo caudato per Travi -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'รจ lav.ne da sopra. -- 2021/10/12 Estesa gestione di testa da sotto, se presente. -- 2021/10/12 Portato a 30deg l'angolo limite per fare l'antischeggia. +-- 2022/01/26 Migliorato controllo lavorazione con fresa su testa da sotto. -- Tabella per definizione modulo local ProcessProfCamb = {} @@ -289,8 +290,9 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- recupero la lavorazione di fresatura local sMillType = 'Prof' sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', '')) - if not sMilling then + if not sMilling and bMillDown then sMilling = ML.FindMilling( sMillType) + bMillDown = false end if not sMilling then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library' @@ -311,9 +313,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- recupero la lavorazione local sCutType = 'HeadSide' local sCutting = ML.FindCutting( sCutType .. EgtIf( bMillDown, '_H2', '')) - if not sCutting then - sCutting = ML.FindCutting( sCutType) - end + -- se richiesto taglio con lama da sotto e non trovato non posso utilizzare quello da sopra if not sCutting then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing not found in library' EgtOutLog( sErr) diff --git a/LuaLibs/ProcessStepJoint.lua b/LuaLibs/ProcessStepJoint.lua index 6c738f4..38e6f8d 100644 --- a/LuaLibs/ProcessStepJoint.lua +++ b/LuaLibs/ProcessStepJoint.lua @@ -1,4 +1,4 @@ --- ProcessStepJoint.lua by Egaltech s.r.l. 2021/01/23 +-- ProcessStepJoint.lua by Egaltech s.r.l. 2022/01/26 -- Gestione calcolo giunto a gradino per Travi -- Tabella per definizione modulo @@ -81,7 +81,13 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) end local dExtra = 2 -- recupero la lavorazione - local sMilling = ML.FindMilling( 'Mark') + local sMillType = 'Mark' + local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1) + local sMilling = ML.FindMilling( sMillType .. EgtIf( bDownHead, '_H2', '')) + if not sMilling and bDownHead then + sMilling = ML.FindMilling( sMillType) + bDownHead = false + end if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr) diff --git a/LuaLibs/ProcessStepJointNotch.lua b/LuaLibs/ProcessStepJointNotch.lua index ead63e4..edbfe86 100644 --- a/LuaLibs/ProcessStepJointNotch.lua +++ b/LuaLibs/ProcessStepJointNotch.lua @@ -53,10 +53,11 @@ local function MachineByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Solid, -- delta negativo affondamento lama local dExtraUp = -0.3 -- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -30deg) - local bTopHead = ( BD.DOWN_HEAD and vtN[nBigInd]:getZ() > -1.) - local bDownHead = ( BD.DOWN_HEAD and vtN[nBigInd]:getZ() < -1.) + local bTopHead = ( BD.DOWN_HEAD and vtN[nBigInd]:getZ() > -0.5) + local bDownHead = ( BD.DOWN_HEAD and vtN[nBigInd]:getZ() < -0.5) -- recupero la lavorazione - local sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bDownHead, '_H2', '')) + local sCutType = 'HeadSide' + local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', '')) if not sCutting and bTopHead then sCutting = ML.FindCutting( sCutType) bDownHead = false @@ -128,7 +129,7 @@ local function MachineByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Solid, end -- altrimenti, tagli diretti delle facce else - local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide') + local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), nil, bDownHead) if not bOk then return bOk, sErr end @@ -531,7 +532,13 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) local dExtra = 2 -- recupero la lavorazione - local sMilling = ML.FindMilling( 'Mark') + local sMillType = 'Mark' + local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1) + local sMilling = ML.FindMilling( sMillType .. EgtIf( bDownHead, '_H2', '')) + if not sMilling and bDownHead then + sMilling = ML.FindMilling( sMillType) + bDownHead = false + end if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr)