From e95990cb230ed9c017654a0929c1464337caaf50 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Fri, 22 May 2020 13:37:28 +0000 Subject: [PATCH] DataBeam : - correzione a rotazione di 90 gradi nel caso DY > DZ in posizione standard - correzione a IsHeadFeature e IsTailFeature di LapJoint (crash). --- LuaLibs/BeamExec.lua | 10 +++++++--- LuaLibs/ProcessLapJoint.lua | 10 +++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 43a868c..567b5fb 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1,4 +1,4 @@ --- BeamExec.lua by Egaltech s.r.l. 2020/05/19 +-- BeamExec.lua by Egaltech s.r.l. 2020/05/21 -- Libreria esecuzione lavorazioni per Travi -- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3. -- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato. @@ -11,6 +11,7 @@ -- 2020/04/14 Aggiunta gestione Dovetail. -- 2020/05/16 Migliorie ordinamento fori. -- 2020/05/16 Gestione rotazione di 90deg. +-- 2020/05/21 Correzione rotazione di 90deg (caso DY > DZ). -- Tabella per definizione modulo local BeamExec = {} @@ -969,11 +970,13 @@ function BeamExec.ProcessFeatures() -- vettore movimento grezzi per rotazione di 90deg local dDeltaYZ = EgtGetRawPartBBox( nRawId):getDimY() - EgtGetRawPartBBox( nRawId):getDimZ() local vtMove = Vector3d( 0, dDeltaYZ / 2, dDeltaYZ / 2) + local bPreMove = ( dDeltaYZ < 0) -- ruoto le travi della fase corrente local nRId = nRawId while nRId do - EgtMoveRawPart( nRId, vtMove) + if bPreMove then EgtMoveRawPart( nRId, vtMove) end EgtRotateRawPart( nRId, X_AX(), 90) + if not bPreMove then EgtMoveRawPart( nRId, vtMove) end nRId = EgtGetNextRawPart( nRId) end EgtSetInfo( nDispId, 'ROT', -1) @@ -996,8 +999,9 @@ function BeamExec.ProcessFeatures() -- se era taglio di separazione, aggiungo nuova fase if bNewPhase then BL.AddPhaseWithRawParts( nRawId, BD.OriTR, BD.RAW_OFFSET) - EgtMoveRawPart( nRawId, vtMove) + if bPreMove then EgtMoveRawPart( nRawId, vtMove) end EgtRotateRawPart( nRawId, X_AX(), 90) + if not bPreMove then EgtMoveRawPart( nRawId, vtMove) end -- se grezzo successivo senza pezzi e finale, va tolto local nNextRawId = EgtGetNextRawPart( nRawId) if nNextRawId and EgtGetPartInRawPartCount( nNextRawId) == 0 and EgtGetRawPartBBox( nNextRawId):getDimX() < BD.MinRaw then diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 92865d8..2df6b60 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2020/04/24 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2020/05/21 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. @@ -350,11 +350,11 @@ function ProcessLapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH) local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL) local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) - if vtN:getZ() < BD.NZ_MINA and nFacInd2 then + if vtN and vtN:getZ() < BD.NZ_MINA and nFacInd2 then ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT) nFacInd, nFacInd2 = nFacInd2, nFacInd end - if vtN:getX() < 0.499 then + if vtN and vtN:getX() < 0.499 then return false elseif Proc.Fct >= 5 then return true @@ -404,11 +404,11 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw) -- deve avere la normale principale diretta verso la coda local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) - if vtN:getZ() < BD.NZ_MINA and nFacInd2 then + if vtN and vtN:getZ() < BD.NZ_MINA and nFacInd2 then ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT) nFacInd, nFacInd2 = nFacInd2, nFacInd end - if vtN:getX() > -0.499 then + if vtN and vtN:getX() > -0.499 then return false else return true