diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index d9eaf3d..fde8a9b 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -1,10 +1,11 @@ --- ProcessDtMortise.lua by Egaltech s.r.l. 2022/05/01 +-- ProcessDtMortise.lua by Egaltech s.r.l. 2022/06/01 -- Gestione calcolo mortase a coda di rondine per Travi -- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa. -- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto. -- 2021/06/28 Aggiunta gestione attacco e uscita con pocket. -- 2021/07/20 Aggiunta gestione rinvio angolare su FAST. -- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda). +-- 2022/06/01 Modifiche per evitare di entrare nel legno con mortase parziali. -- Tabella per definizione modulo local ProcessDtMortise = {} @@ -119,6 +120,21 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol return NewAuxId end +--------------------------------------------------------------------- +-- verifica che il box includa il punto in XY +function EnclosesPoint( b3Box, ptP) + if b3Box[2][1] < ptP[1] - GEO.EPS_SMALL or b3Box[1][1] > ptP[1] + GEO.EPS_SMALL then + return false + end + if b3Box[2][2] < ptP[2] - GEO.EPS_SMALL or b3Box[1][2] > ptP[2] + GEO.EPS_SMALL then + return false + end + if b3Box[2][3] < ptP[3] - GEO.EPS_SMALL or b3Box[1][3] > ptP[3] + GEO.EPS_SMALL then + return false + end + return true +end + --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) @@ -424,6 +440,23 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2) EgtSetMachiningParam( MCH_MP.LIPERP, 5) EgtSetMachiningParam( MCH_MP.LIELEV, 0) + -- altrimenti verifico se sono bilanciati ingresso e uscita, per evitare inizio o fine nel legno + else + local ptS = EgtSP( AuxId, GDB_ID.ROOT) + local ptE = EgtEP( AuxId, GDB_ID.ROOT) + local dDistS = abs( ( ptS - rfDtMrt:getOrigin()) * rfDtMrt:getVersX()) + local dDistE = abs( ( ptE - rfDtMrt:getOrigin()) * rfDtMrt:getVersX()) + local dIni, dFin = EgtCurveDomain( AuxId) + local nCrvCnt = dFin - dIni - 1 + if abs( dDistS - dDistE) > 20 then + local b3Test = BBox3d( b3Solid) + b3Test:expand( -5) + if dDistS < dDistE and EnclosesPoint( b3Test, ptS) and EgtCurveCompoAngCenter( AuxId, 0) == 0 then + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dDistE - dDistS) + elseif dDistE < dDistS and EnclosesPoint( b3Test, ptE) and EgtCurveCompoAngCenter( AuxId, nCrvCnt) == 0 then + EgtSetMachiningParam( MCH_MP.ENDADDLEN, dDistS - dDistE) + end + end end -- dichiaro non si generano sfridi per VMill local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'