From 0bf374a53ff08bd352b74909ab53acb434702db6 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 7 Aug 2019 18:30:58 +0000 Subject: [PATCH] DataBeam : - migliorie varie. --- LuaLibs/BeamExec.lua | 1 + LuaLibs/BeamLib.lua | 8 ++++++++ LuaLibs/DiceCut.lua | 18 ++++++++++-------- LuaLibs/ProcessDtMortise.lua | 10 +++++++--- LuaLibs/ProcessLapJoint.lua | 28 ++++++++++++++++++++-------- 5 files changed, 46 insertions(+), 19 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 5de5f7b..62df72d 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -524,6 +524,7 @@ local function ClassifyFeatures( vProc, b3Raw, Stats) else Proc.Flg = 0 bAllOk = false + table.insert( Stats, {Err = 1, Msg='Error : classify failed', CutId=Proc.CutId, TaskId=Proc.TaskId}) end end -- se necessario ribaltamento, assegno intestatura alla fase ribaltata diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 2048c43..2f01bc3 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -364,6 +364,7 @@ function BeamLib.GetFaceWithMostAdj( nSurfId) -- recupero le facce non in sottosquadra e con il maggior numero di adiacenze local nFacInd = {} local nMaxAdj = 0 + local nSupAdj = 0 for i = 1, nFacCnt do if not vUcut[i] then if vAdj[i] > nMaxAdj then @@ -374,6 +375,13 @@ function BeamLib.GetFaceWithMostAdj( nSurfId) table.insert( nFacInd, i - 1) end end + if vAdj[i] > nSupAdj then + nSupAdj = vAdj[i] + end + end + -- verifico non ci sia una faccia in sottosquadra con adiacenza superiore + if nSupAdj > nMaxAdj then + return -2, GEO.INFINITO end -- premio la faccia con minore elevazione local nFacOpt, nFacOpt2 diff --git a/LuaLibs/DiceCut.lua b/LuaLibs/DiceCut.lua index 9595ea9..5329152 100644 --- a/LuaLibs/DiceCut.lua +++ b/LuaLibs/DiceCut.lua @@ -1,4 +1,4 @@ --- DiceCut.lua by Egaltech s.r.l. 2019/07/01 +-- DiceCut.lua by Egaltech s.r.l. 2019/08/07 -- Gestione dei piano paralleli nei tagli lunghi -- Tabella per definizione modulo @@ -359,15 +359,17 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl end -- calcolo la direzione dei piani ortogonali local vtO = VectorFromUprightOrtho( vtNInner) - vtO:rotate( vtNInner, 90) - -- se diretto troppo ortogonalmente all'asse trave e taglio non da sotto, lo ruoto ulteriormente - if abs( vtO:getY()) > abs( vtO:getX()) and vtNInner:getZ() > -0.5 then + if vtNInner:getZ() > -0.05 or vtNInner:getZ() < -0.5 then vtO:rotate( vtNInner, 90) - else - if ptCInner:getX() > BBoxRawPart:getCenter():getX() then - if vtO:getX() < 0 then vtO = - vtO end + -- se diretto troppo ortogonalmente all'asse trave e taglio non da sotto, lo ruoto ulteriormente + if abs( vtO:getY()) > abs( vtO:getX()) and vtNInner:getZ() > -0.5 then + vtO:rotate( vtNInner, 90) else - if vtO:getX() > 0 then vtO = - vtO end + if ptCInner:getX() > BBoxRawPart:getCenter():getX() then + if vtO:getX() < 0 then vtO = - vtO end + else + if vtO:getX() > 0 then vtO = - vtO end + end end end -- calcolo le dimensioni dell'offset e se dove posizionare la prima faccia: diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index 5e399ef..2991d56 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -1,4 +1,4 @@ --- ProcessMortise.lua by Egaltech s.r.l. 2019/03/22 +-- ProcessMortise.lua by Egaltech s.r.l. 2019/08/07 -- Gestione calcolo mortase a coda di rondice per Travi -- Tabella per definizione modulo @@ -71,8 +71,12 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId) dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam end end - -- verifico se necessarie più passate - local dDist = dist( EgtSP( AuxId, GDB_RT.GLOB), EgtEP( AuxId, GDB_RT.GLOB)) + -- verifico se necessarie più passate (distanza all'imbocco ortogonale all'asse) + local vtDiff = EgtEP( AuxId, GDB_RT.GLOB) - EgtSP( AuxId, GDB_RT.GLOB) + local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB) + vtAx:normalize() + local vtOrtDiff = vtDiff - vtDiff * vtAx * vtAx + local dDist = vtOrtDiff:len() if dDist < dToolDiam + 0.5 then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Dt mortise too narrow' EgtOutLog( sErr) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 8ff9b5b..5e3614e 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2019/07/30 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2019/08/07 -- Gestione calcolo mezzo-legno per Travi -- Tabella per definizione modulo @@ -225,16 +225,28 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId) end -- scelta faccia da lavorare local nFacInd - -- se entrambe possibili, scelgo quella con la normale più perpendicolare all'asse trave (se uguali, quella verso X+) + -- se entrambe possibili if bFaceOk[0] and bFaceOk[1] then - if abs( abs( vtN[0]:getX()) - abs( vtN[1]:getX())) < GEO.EPS_SMALL then - if ptM:getX() > b3Raw:getCenter():getX() then - nFacInd = EgtIf( vtN[0]:getX() > vtN[1]:getX(), 0, 1) + -- se in testa o coda, scelgo quella con la normale più parallela all'asse trave + if Proc.Head or Proc.Tail then + if vtN[0]:getZ() < BD.NZ_MINA then + nFacInd = 1 + elseif vtN[1]:getZ() < BD.NZ_MINA then + nFacInd = 0 else - nFacInd = EgtIf( vtN[0]:getX() < vtN[1]:getX(), 0, 1) + nFacInd = EgtIf( abs( vtN[0]:getX()) > abs( vtN[1]:getX()), 0, 1) end + -- altrimenti, scelgo quella con la normale più perpendicolare all'asse trave (se uguali, quella verso X+) else - nFacInd = EgtIf( abs( vtN[0]:getX()) < abs( vtN[1]:getX()), 0, 1) + if abs( abs( vtN[0]:getX()) - abs( vtN[1]:getX())) < GEO.EPS_SMALL then + if ptM:getX() > b3Raw:getCenter():getX() then + nFacInd = EgtIf( vtN[0]:getX() > vtN[1]:getX(), 0, 1) + else + nFacInd = EgtIf( vtN[0]:getX() < vtN[1]:getX(), 0, 1) + end + else + nFacInd = EgtIf( abs( vtN[0]:getX()) < abs( vtN[1]:getX()), 0, 1) + end end elseif bFaceOk[0] then nFacInd = 0 @@ -476,7 +488,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId) assert( ( Proc.Fct > 2), 'Error : MakeMoreFaces in LapJoint with ' .. tostring( Proc.Fct) .. ' faces') -- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa local nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id) - assert( nFacInd, 'Error : MakeMoreFaces could not find reference face') + assert( ( nFacInd and nFacInd >= 0), 'Error : MakeMoreFaces could not find reference face') -- dati della faccia local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) -- se orientata verso il basso, verifico l'alternativa