From 6aac5da9b66682c8957f102c40a9f70e403121c2 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 11 Nov 2019 07:36:37 +0000 Subject: [PATCH] DataBeam : - in LapJoint migliorata gestione tagli con lama quando 2 facce - in LapJoint tolto controllo volume per caso 2 facce con fresa - in Mortise si recupera la dimensione minima per scegliere l'utensile adeguato. --- LuaLibs/ProcessLapJoint.lua | 32 +++++++++++++++++++++++--------- LuaLibs/ProcessMortise.lua | 13 ++++++++----- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index f9121a8..a503a71 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2019/11/07 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2019/11/10 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. @@ -523,8 +523,19 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, bOpenEnd = ( vAdj2[k] < 0) end end - -- Se entrambi gli estremi sono aperti e fattibile con lama - if bOpenStart and bOpenEnd and dElev <= BD.MAX_DIM_DICE then + -- Recupero il massimo affondamento possibile con la lama + local dSawMaxDepth = 0 + local sCutting = ML.FindCutting( 'HeadSide') + if sCutting then + if EgtMdbSetCurrMachining( sCutting) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dSawMaxDepth = EgtTdbGetCurrToolMaxDepth() or dSawMaxDepth + end + end + end + -- Se entrambi gli estremi sono aperti e possibile, lavoro con la lama + if bOpenStart and bOpenEnd and dElev < dSawMaxDepth then -- Recupero la lavorazione di lama local sCutting = ML.FindCutting( 'HeadSide') if not sCutting then @@ -540,6 +551,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick + dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth end end -- Calcolo uso faccia @@ -554,7 +566,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, end for i = 1, nStep do local dOffs = ( i - 1) * dStep - local bOk, sErr = BL.MakeOneFaceBySaw( Proc.Id, nFacAdj, sCutting, dSawDiam, nFaceUse, nil, 0, BD.CUT_SIC, dOffs, 0, nil, b3Raw) + local bOk, sErr = BL.MakeOneFaceBySaw( Proc.Id, nFacAdj, sCutting, dSawDiam, nFaceUse, -0.01, 0, BD.CUT_SIC, dOffs, 0, nil, b3Raw) if not bOk then return bOk, sErr end @@ -587,6 +599,11 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth end end + if dSawThick > dV + 10 * GEO.EPS_SMALL then + local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' chainsaw too thick' + EgtOutLog( sErr) + return false, sErr + end -- Verifico se necessarie più passate local nStep = ceil( ( dV - 0.5) / dSawThick) local dStep = 0 @@ -800,7 +817,6 @@ end function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- limiti di fresatura semplice local MAX_MILL_LIN = 80 - local MAX_MILL_VOL = ( 80 * 240 * 20) / 2 -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) @@ -835,8 +851,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- una faccia if Proc.Fct == 1 then -- se piccola, con fresa - if ( Proc.Box:getDimX() < MAX_MILL_LIN and ( Proc.Box:getDimZ() < MAX_MILL_LIN or Proc.Box:getDimY() < MAX_MILL_LIN)) or - Proc.Box:getDimX() * Proc.Box:getDimY() * Proc.Box:getDimZ() < MAX_MILL_VOL then + if ( Proc.Box:getDimX() < MAX_MILL_LIN and ( Proc.Box:getDimZ() < MAX_MILL_LIN or Proc.Box:getDimY() < MAX_MILL_LIN)) then return MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId) -- altrimenti, con lama else @@ -848,8 +863,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) -- se ortogonali e piccole, con fresa if bAdj and abs( dAng + 90) < 1 and - ( ( Proc.Box:getDimX() < MAX_MILL_LIN and ( Proc.Box:getDimZ() < MAX_MILL_LIN or Proc.Box:getDimY() < MAX_MILL_LIN)) or - Proc.Box:getDimX() * Proc.Box:getDimY() * Proc.Box:getDimZ() < MAX_MILL_VOL) then + ( Proc.Box:getDimX() < MAX_MILL_LIN and ( Proc.Box:getDimZ() < MAX_MILL_LIN or Proc.Box:getDimY() < MAX_MILL_LIN)) then return MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId) -- altrimenti, con lama else diff --git a/LuaLibs/ProcessMortise.lua b/LuaLibs/ProcessMortise.lua index 7e8b5f3..af4d4fc 100644 --- a/LuaLibs/ProcessMortise.lua +++ b/LuaLibs/ProcessMortise.lua @@ -1,4 +1,4 @@ --- ProcessMortise.lua by Egaltech s.r.l. 2019/10/08 +-- ProcessMortise.lua by Egaltech s.r.l. 2019/11/10 -- Gestione calcolo mortase per Travi -- Tabella per definizione modulo @@ -54,23 +54,26 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId) EgtSetInfo( AuxId, 'OPEN', nCount) end -- recupero i dati del bottom - local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) + local frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_ID.ROOT) + local ptC = frMor:getOrigin() + local vtN = frMor:getVersZ() EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3) - -- verifico che la mortasa non sia orientata verso il basso (-5 deg) + -- verifico che la mortasa non sia orientata verso il basso (limite -5 deg) if vtN:getZ() < - 0.1 then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mortise from bottom impossible' EgtOutLog( sErr) return false, sErr end -- determino altezza della mortasa - local frMor = Frame3d( ptC, vtN) local b3Mor = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frMor) local dMorH = b3Mor:getDimZ() -- elevazione del punto centro local _, dCenElev = BL.GetPointDirDepth( nPartId, ptC, vtN) dMorH = max( dMorH, dCenElev or 0) + -- determino larghezza della mortasa + if dL < dW then dL, dW = dW, dL end -- recupero la lavorazione - local sPocketing = ML.FindPocketing( 'Pocket', 30) + local sPocketing = ML.FindPocketing( 'Pocket', dW) if not sPocketing then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' pocketing not found in library' EgtOutLog( sErr)