From 1e612fac4ac879a61300c47818d3ff4073b2ebc2 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 25 May 2020 08:28:01 +0000 Subject: [PATCH] DataBeam : - corretta assegnazione fori cieca a fase ribaltata e non ruotata - corretta gestione ruotato insieme con ribaltato senza lavorazioni subito dopo carico della barra. --- LuaLibs/BeamExec.lua | 43 +++++++++++++++++++++++++++++++------- LuaLibs/ProcessDrill.lua | 8 +++++-- LuaLibs/ProcessHeadCut.lua | 10 ++++----- 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 37a78ad..925976d 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1,4 +1,4 @@ --- BeamExec.lua by Egaltech s.r.l. 2020/05/21 +-- BeamExec.lua by Egaltech s.r.l. 2020/05/25 -- 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. @@ -12,6 +12,7 @@ -- 2020/05/16 Migliorie ordinamento fori. -- 2020/05/16 Gestione rotazione di 90deg. -- 2020/05/21 Correzione rotazione di 90deg (caso DY > DZ). +-- 2020/05/25 Correzione rotazione di 90deg dopo scarico su carico. -- Tabella per definizione modulo local BeamExec = {} @@ -175,9 +176,10 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam) local sOut = 'Error creating Additional Group in Part ' .. tostring( Pz) return false, sOut end - -- se sovramateriale di testa, aggiungo faccia per taglio iniziale al pezzo + -- aggiungo faccia per taglio iniziale al pezzo + BL.AddPartStartFace( Pz, b3Solid) + -- se sovramateriale di testa, lo notifico if DeltaS > 0.09 then - BL.AddPartStartFace( Pz, b3Solid) EgtSetInfo( nRaw, 'HOVM', DeltaS) end -- aggiungo faccia per taglio finale al pezzo @@ -686,14 +688,14 @@ local function PrintFeatures( vProc, b3Raw) end ------------------------------------------------------------------------------------------------------------- -local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, b3Raw) +local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw) local bOk = true local sErr = '' local bNewPhase = false -- se intestatura ( 1-340-X ) if Hcut.Identify( Proc) then -- esecuzione taglio di testa - bOk, sErr = Hcut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) + bOk, sErr = Hcut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut) -- se separazione ( 2-350-X ) elseif Split.Identify( Proc) then -- esecuzione separazione o eliminazione grezzo residuo @@ -843,6 +845,29 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, b3 return bOk, sErr, bNewPhase end +------------------------------------------------------------------------------------------------------------- +local function VerifyNeedForHeadCut( vProc, bSomeDown, bSomeSide) + -- verifico se necessaria la rotazione di 90 gradi + if not bSomeSide then + return false + end + -- verifico se viene dopo un pezzo diviso quando ruotato (quindi con rimanenza scaricata sul carico) + local nPrevPhase = EgtGetCurrPhase() - 1 + local nPrevDispId = EgtGetPhaseDisposition( nPrevPhase) or GDB_ID.NULL + local nPrevType = EgtGetInfo( nPrevDispId, 'TYPE') + if nPrevType ~= 'MID2' and nPrevType ~= 'END2' then + return false + end + -- verifico se c'è una sola lavorazione ribaltata (quindi è il taglio di testa) + local nDownCnt = 0 + for i = 1, #vProc do + if vProc[i].Down then + nDownCnt = nDownCnt + 1 + end + end + return ( nDownCnt == 1) +end + ------------------------------------------------------------------------------------------------------------- local function MoveDrillsOnTenon( vProc) -- se non richiesto spostamento fori su tenone, esco @@ -918,6 +943,8 @@ function BeamExec.ProcessFeatures() if EgtGetDebugLevel() >= 1 then PrintFeatures( vProc, b3Raw) end + -- verifico se comunque necessario taglio di testa + local bNeedHCut = VerifyNeedForHeadCut( vProc, bSomeDown, bSomeSide) -- eventuale spostamento fori sui tenoni MoveDrillsOnTenon( vProc) -- se richiesto ribaltamento (oppure rotazione) @@ -934,7 +961,7 @@ function BeamExec.ProcessFeatures() -- creo la lavorazione local Proc = vProc[i] if Proc.Flg ~= 0 and Proc.Down then - local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, b3Raw) + local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw) if not bOk then nTotErr = nTotErr + 1 table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId}) @@ -1001,7 +1028,7 @@ function BeamExec.ProcessFeatures() -- creo la lavorazione local Proc = vProc[i] if Proc.Flg ~= 0 and Proc.Side then - local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, b3Raw) + local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw) if not bOk then nTotErr = nTotErr + 1 table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId}) @@ -1056,7 +1083,7 @@ function BeamExec.ProcessFeatures() -- creo la lavorazione local Proc = vProc[i] if Proc.Flg ~= 0 and not ( Proc.Down or Proc.Side) then - local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, b3Raw) + local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw) if not bOk then nTotErr = nTotErr + 1 table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId}) diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 241d79d..fb61c34 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -1,4 +1,4 @@ --- ProcessDrill.lua by Egaltech s.r.l. 2020/05/19 +-- ProcessDrill.lua by Egaltech s.r.l. 2020/05/23 -- Gestione calcolo forature per Travi -- Tabella per definizione modulo @@ -127,7 +127,11 @@ function ProcessDrill.Classify( Proc, b3Raw) local bFaceDown = ( ptCen:getZ() < b3Raw:getMin():getZ() + dDiam / 2 and not Proc.Head and not Proc.Tail) -- verifico se il foro è sotto e quindi va spostato o sopra o sul fianco if (( vtExtr:getZ() < BD.DRILL_VZ_MIN or bFaceDown) and ( not bOpen or Proc.Flg ~= 1)) then - return true, not BD.ROT90, BD.ROT90 + if not bOpen then + return true, true, false + else + return true, not BD.ROT90, BD.ROT90 + end else return true, false, false end diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index 1c3da51..7d002e3 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -1,4 +1,4 @@ --- ProcessSplit.lua by Egaltech s.r.l. 2020/04/10 +-- ProcessSplit.lua by Egaltech s.r.l. 2020/05/25 -- Gestione calcolo tagli di testa per Travi -- Tabella per definizione modulo @@ -22,7 +22,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione -function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) +function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut) -- ingombro del grezzo local b3Raw = EgtGetRawPartBBox( nRawId) -- recupero la lavorazione @@ -48,14 +48,14 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) local bDoubleCut = ( not bHorizCut and b3Raw:getDimY() > dDimYRef + 10 * GEO.EPS_SMALL) -- dati geometrici del taglio local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) - -- se coincide con inizio grezzo, non va fatto - if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL then + -- se non obbligatorio e coincide con inizio grezzo, non va fatto + if not bNeedHCut and AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL then return true end -- flag di lavorazione faccia local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT) -- determino se più tagli con offset - local nCuts = ceil( dOvmHead / BD.MAX_LEN_SCRAP) + local nCuts = max( ceil( dOvmHead / BD.MAX_LEN_SCRAP), 1) local dOffsL = dOvmHead / nCuts -- calcolo extra taglio ed accorciamento local dCutExtra = 0