From 105c3b005139dd85100ff044ac0985cb7464b1bb Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 23 Apr 2021 13:54:21 +0200 Subject: [PATCH] =?UTF-8?q?DataBeam=20:=20-=20in=20LapJoint=20corretto=20c?= =?UTF-8?q?aso=20in=20cui=20antischeggia=20non=20vengono=20inseriti=20perc?= =?UTF-8?q?h=C3=A8=20inutili.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/ProcessLapJoint.lua | 116 +++++++++++++++++++----------------- 1 file changed, 60 insertions(+), 56 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 22c3522..f60013b 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2021/04/21 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2021/04/23 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. -- 2021/01/24 Con sega a catena ora sempre impostato asse A. @@ -11,6 +11,7 @@ -- 2021/04/14 Correzioni ribasso a U con fresa da sotto. -- 2021/04/15 Aggiunta gestione massima lunghezza fresa da sotto su svuotature. -- 2021/04/21 Anche feature lunga con due facce con opzione lama ora si taglia con lama. +-- 2021/04/23 Corretto caso con antischeggia non inseriti perchè inutili. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -3709,66 +3710,69 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local dSawThick = 0 bMadeASbyBld, sWarn, nIdMach, dSawThick = MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw) if not bMadeASbyBld then return false, sWarn end - -- verifico se da invertire - local bInvertMach = false - if bIsU then - if abs(vtN:getZ()) > 0.63 or abs(vtN:getY()) > 0.63 then --- if abs(vtN:getZ()) > 0.7 or abs(vtN:getY()) > 0.7 then - -- prendo il vettore normale alla faccia - local _, vtNFc = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT) - -- valuto l'angolo tra le due facce - local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, nFacet, GDB_ID.ROOT) - -- se superficie principale parallela al piano XZ - if nPrefSide == 0 then - -- se facce inclinate \\ allora mandrino a destra (per essere verso l'alto) - if vtNFc:getX() * vtNFc:getZ() > 0 then - nPrefSide = 2 - -- altrimenti facce inclinate // quindi mandrino a sinistra (per essere ancora verso l'alto) - else - nPrefSide = 1 + -- se antischeggia veramente inserito perchè necessario + if nIdMach then + -- verifico se da invertire + local bInvertMach = false + if bIsU then + if abs(vtN:getZ()) > 0.63 or abs(vtN:getY()) > 0.63 then +-- if abs(vtN:getZ()) > 0.7 or abs(vtN:getY()) > 0.7 then + -- prendo il vettore normale alla faccia + local _, vtNFc = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT) + -- valuto l'angolo tra le due facce + local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, nFacet, GDB_ID.ROOT) + -- se superficie principale parallela al piano XZ + if nPrefSide == 0 then + -- se facce inclinate \\ allora mandrino a destra (per essere verso l'alto) + if vtNFc:getX() * vtNFc:getZ() > 0 then + nPrefSide = 2 + -- altrimenti facce inclinate // quindi mandrino a sinistra (per essere ancora verso l'alto) + else + nPrefSide = 1 + end end - end - -- se faccia verso X+ e mandrino verso sinistra - if vtNFc:getX() > 0 and nPrefSide == 1 then - -- se angolo interno e circa -90 - if abs( dAng + 90) < 5 then - bInvertMach = true - end - -- se faccia verso X- e mandrino verso destra - elseif vtNFc:getX() < 0 and nPrefSide == 2 then - -- se angolo interno e circa -90 - if abs( dAng + 90) < 5 then - bInvertMach = true + -- se faccia verso X+ e mandrino verso sinistra + if vtNFc:getX() > 0 and nPrefSide == 1 then + -- se angolo interno e circa -90 + if abs( dAng + 90) < 5 then + bInvertMach = true + end + -- se faccia verso X- e mandrino verso destra + elseif vtNFc:getX() < 0 and nPrefSide == 2 then + -- se angolo interno e circa -90 + if abs( dAng + 90) < 5 then + bInvertMach = true + end end end end - end - -- eseguo inversione - if bInvertMach then - local bToolInvert = EgtGetMachiningParam( MCH_MP.TOOLINVERT) - local nWS = EgtGetMachiningParam( MCH_MP.WORKSIDE) - local nInvWS = EgtIf( nWS == MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT) - local nFaceUse = EgtGetMachiningParam( MCH_MP.FACEUSE) - local bOrtUp = ( nFaceUse >= MCH_MILL_FU.ORTUP_DOWN and nFaceUse <= MCH_MILL_FU.ORTUP_RIGHT) - if not bOrtUp then - -- assegno i parametri invertiti - EgtSetMachiningParam( MCH_MP.WORKSIDE, nInvWS) - EgtSetMachiningParam( MCH_MP.TOOLINVERT, not bToolInvert) - -- setto l'offset pari allo spessore lama - EgtSetMachiningParam( MCH_MP.OFFSL, -dSawThick) + -- eseguo inversione + if bInvertMach then + local bToolInvert = EgtGetMachiningParam( MCH_MP.TOOLINVERT) + local nWS = EgtGetMachiningParam( MCH_MP.WORKSIDE) + local nInvWS = EgtIf( nWS == MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT) + local nFaceUse = EgtGetMachiningParam( MCH_MP.FACEUSE) + local bOrtUp = ( nFaceUse >= MCH_MILL_FU.ORTUP_DOWN and nFaceUse <= MCH_MILL_FU.ORTUP_RIGHT) + if not bOrtUp then + -- assegno i parametri invertiti + EgtSetMachiningParam( MCH_MP.WORKSIDE, nInvWS) + EgtSetMachiningParam( MCH_MP.TOOLINVERT, not bToolInvert) + -- setto l'offset pari allo spessore lama + EgtSetMachiningParam( MCH_MP.OFFSL, -dSawThick) + end + end + -- posizione del braccio : se primo taglio la recupero, altrimenti la imposto + if not nPrevSCC then + nPrevSCC = EgtGetMachiningParam( MCH_MP.SCC) + else + EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC) + end + -- rieseguo + if not EgtApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nIdMach, false) + return false, sErr end - end - -- posizione del braccio : se primo taglio la recupero, altrimenti la imposto - if not nPrevSCC then - nPrevSCC = EgtGetMachiningParam( MCH_MP.SCC) - else - EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC) - end - -- rieseguo - if not EgtApplyMachining( true, false) then - local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nIdMach, false) - return false, sErr end end end