From a4bbc3767cc3ee3bceb8f36244ee2067a46a55ee Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 12 Aug 2019 09:42:39 +0000 Subject: [PATCH] DataBeam : - migliorie varie. --- LuaLibs/ProcessLapJoint.lua | 36 +++++++++++++++++------------------- LuaLibs/ProcessMortise.lua | 2 +- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 5e3614e..4ba4fea 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2019/08/07 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2019/08/09 -- Gestione calcolo mezzo-legno per Travi -- Tabella per definizione modulo @@ -102,8 +102,9 @@ function ProcessLapJoint.Classify( Proc) -- dati della faccia local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) -- verifico se รจ lavorabile solo dal basso - local bDown = ( vtN:getZ() < BD.NZ_MINA) - return true, bDown + --local bDown = ( vtN:getZ() < BD.NZ_MINA) + --return true, bDown + return true, false -- se 2 facce elseif Proc.Fct == 2 then -- dati delle facce @@ -131,7 +132,7 @@ function ProcessLapJoint.Classify( Proc) local bDown = ( vtN:getZ() < BD.NZ_MINA) -- se verso il basso, verifico se utilizzabile seconda faccia if bDown then - if nFacInd2 then + if nFacInd2 and dElev2 < 2 * dElev then local ptC2, vtN2 = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT) bDown = ( vtN2:getZ() < BD.NZ_MINA) end @@ -148,15 +149,10 @@ local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId) local b3Raw = EgtGetRawPartBBox( nRawId) -- verifico il numero di facce della tacca assert( ( Proc.Fct == 1), 'Error : MakeOneFaceByMill in LapJoint with ' .. tostring( Proc.Fct) .. ' faces') - -- dati delle facce + -- dati della faccia local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) - -- verifico non siano orientate verso il basso - local bFaceOk = ( vtN:getZ() >= BD.NZ_MINB) - if not bFaceOk then - local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' LapJoint from bottom impossible' - EgtOutLog( sErr) - return false, sErr - end + -- verifico se orientata verso l'alto + local bUp = ( vtN:getZ() >= BD.NZ_MINA) -- scelta faccia da lavorare local nFacInd = 0 -- recupero la lavorazione @@ -178,12 +174,13 @@ local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId) EgtSetMachiningGeometry( {{ Proc.Id, nFacInd}}) -- imposto uso faccia e lato correzione if vtN:getX() > 0 then - EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_LEFT) + EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bUp, MCH_MILL_FU.ORTHO_LEFT, MCH_MILL_FU.PARAL_LEFT)) else - EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_RIGHT) + EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bUp, MCH_MILL_FU.ORTHO_RIGHT, MCH_MILL_FU.PARAL_RIGHT)) end -- imposto lato di correzione EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + if not bUp then EgtSetMachiningParam( MCH_MP.INVERT, true) end -- imposto posizione braccio porta testa if vtN:getY() < GEO.EPS_SMALL then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM) @@ -484,8 +481,6 @@ end local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId) -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) - -- recupero il numero di facce della tacca - 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 and nFacInd >= 0), 'Error : MakeMoreFaces could not find reference face') @@ -495,6 +490,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId) if vtN:getZ() < BD.NZ_MINA and nFacInd2 then ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT) nFacInd, nFacInd2 = nFacInd2, nFacInd + dFacElev, dFacElev2 = dFacElev2, dFacElev end local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) -- verifico non sia orientata verso il basso @@ -612,7 +608,7 @@ end --------------------------------------------------------------------- function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId) -- limiti di fresatura semplice - local MAX_MILL_XZ = 80 + local MAX_MILL_LIN = 80 local MAX_MILL_VOL = ( 80 * 240 * 20) / 2 -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) @@ -660,7 +656,8 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId) -- una faccia if Proc.Fct == 1 then -- se piccola, con fresa - if ( Proc.Box:getDimX() < MAX_MILL_XZ and Proc.Box:getDimZ() < MAX_MILL_XZ) 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)) or + Proc.Box:getDimX() * Proc.Box:getDimY() * Proc.Box:getDimZ() < MAX_MILL_VOL then return MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId) -- altrimenti, con lama else @@ -672,7 +669,8 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId) local _, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) -- se ortogonali e piccole, con fresa if abs( dAng + 90) < 1 and - (( Proc.Box:getDimX() < MAX_MILL_XZ and Proc.Box:getDimZ() < MAX_MILL_XZ) 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)) or + Proc.Box:getDimX() * Proc.Box:getDimY() * Proc.Box:getDimZ() < MAX_MILL_VOL) then return MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId) -- altrimenti, con lama else diff --git a/LuaLibs/ProcessMortise.lua b/LuaLibs/ProcessMortise.lua index f5fd476..ab28892 100644 --- a/LuaLibs/ProcessMortise.lua +++ b/LuaLibs/ProcessMortise.lua @@ -1,4 +1,4 @@ --- ProcessMortise.lua by Egaltech s.r.l. 2019/07/08 +-- ProcessMortise.lua by Egaltech s.r.l. 2019/08/08 -- Gestione calcolo mortase per Travi -- Tabella per definizione modulo