diff --git a/BatchProcess.lua b/BatchProcess.lua index 56e28f3..ce317ac 100644 --- a/BatchProcess.lua +++ b/BatchProcess.lua @@ -1,4 +1,4 @@ --- BatchProcess.lua by Egaltech s.r.l. 2019/12/09 +-- BatchProcess.lua by Egaltech s.r.l. 2019/12/10 -- Gestione calcolo batch disposizione e lavorazioni per Travi -- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3. -- 2019/07/16 Aggiunta gestione modalità oltre 10 per impostazione macchina e uscita. @@ -130,18 +130,24 @@ local BL = require( 'BeamLib') -- Carico i dati globali local BD = require( 'BeamData') --- Verifico il tipo di file +-- Dati del file local sDir, sTitle, sExt = EgtSplitPath( BEAM.FILE) local bBtl = ( string.upper( sExt or '') ~= '.NGE') - --- Verifico se coincide con eventuale originale e se esiste già il progetto Nge risultante -local sOriFile = sDir..sTitle..'.ori'..sExt -local sDiffFile = sDir..'Diff.txt' -EgtEraseFile( sDiffFile) -local _, nDiff = EgtTextFileCompare( BEAM.FILE, sOriFile, ';', sDiffFile) -EgtOutLog( 'Diff=' .. tostring( nDiff)) local sNgeFile = sDir..sTitle..'.nge' -local bToProcess = ( not bBtl or nDiff ~= 0 or not EgtExistsFile( sNgeFile)) + +-- In generale va completamente riprocessato +local bToProcess = true +-- se BTL, barra, esiste già il corrispondente progetto Nge +if bBtl and string.find( sTitle, 'Bar_', 1, true) and EgtExistsFile( sNgeFile) then + local sOriFile = sDir..sTitle..'.ori'..sExt + local sDiffFile = sDir..'Diff.txt' + EgtEraseFile( sDiffFile) + local _, nDiff = EgtTextFileCompare( BEAM.FILE, sOriFile, ';', sDiffFile) + -- se BTL corrente coincide con originale, salto il riprocessamento + if nDiff == 0 then + bToProcess = false + end +end -- Inizializzo contatori errori e avvisi local nErrCnt = 0 diff --git a/LuaLibs/ProcessDtTenon.lua b/LuaLibs/ProcessDtTenon.lua index ec8ecf8..db2298d 100644 --- a/LuaLibs/ProcessDtTenon.lua +++ b/LuaLibs/ProcessDtTenon.lua @@ -1,4 +1,4 @@ --- ProcessTenon.lua by Egaltech s.r.l. 2019/11/27 +-- ProcessTenon.lua by Egaltech s.r.l. 2019/12/10 -- Gestione calcolo tenone a coda di rondine per Travi -- Tabella per definizione modulo @@ -77,8 +77,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- ingombro del grezzo local b3Raw = EgtGetRawPartBBox( nRawId) -- ingombro del pezzo - local Ls = EgtGetFirstNameInGroup( nPartId, 'Box') - local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD) + local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) if not b3Solid then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' part box not found' EgtOutLog( sErr) @@ -124,13 +123,12 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) return false, sErr end -- creo piano di taglio sulla testa del tenone e lo lavoro - local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) local AddId = EgtSurfTmPlaneInBBox( EgtGetParent( Proc.Id), ptC, vtN, b3Solid, GDB_RT.GLOB) if AddId then EgtRelocate( AddId, nAddGrpId) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) -- se pezzo piccolo, in coda e piano inclinato attorno a Z applico svuotatura - if b3Solid:getDimX() < 1000 and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 then + if b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 then local sPocketing = ML.FindPocketing( 'OpenPocket') -- inserisco la lavorazione di svuotatura local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) @@ -156,7 +154,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- altrimenti applico taglio di lama else local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg} - local bFromBottom = ( b3Solid:getDimX() < 1000 and vtExtr:getZ() > 0.25) + local bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, 0, bFromBottom) if not bOk then return bOk, sErr end end @@ -231,10 +229,20 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end end -- eventuale segnalazione ingombro di testa o coda - if Proc.Head then - BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()) - elseif Proc.Tail then - BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX()) + if abs( vtN:getY()) > 0.1 or ( b3Raw:getDimZ() - Proc.Box:getDimZ()) < BD.MIN_HEIGHT then + if Proc.Head then + local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX() + if abs( vtN:getY()) < 0.1 and vtN:getZ() > 0.5 then + dOffs = dOffs / 2 + end + BL.UpdateHCING( nRawId, dOffs) + elseif Proc.Tail then + local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX() + if abs( vtN:getY()) < 0.1 and vtN:getZ() > 0.5 then + dOffs = dOffs / 2 + end + BL.UpdateTCING( nRawId, dOffs) + end end return true end diff --git a/LuaLibs/ProcessTenon.lua b/LuaLibs/ProcessTenon.lua index a0fe291..8ab2925 100644 --- a/LuaLibs/ProcessTenon.lua +++ b/LuaLibs/ProcessTenon.lua @@ -1,4 +1,4 @@ --- ProcessTenon.lua by Egaltech s.r.l. 2019/11/27 +-- ProcessTenon.lua by Egaltech s.r.l. 2019/12/10 -- Gestione calcolo tenone per Travi -- Tabella per definizione modulo @@ -78,8 +78,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- ingombro del grezzo local b3Raw = EgtGetRawPartBBox( nRawId) -- ingombro del pezzo - local Ls = EgtGetFirstNameInGroup( nPartId, 'Box') - local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD) + local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) if not b3Solid then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' part box not found' EgtOutLog( sErr) @@ -131,13 +130,12 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) return false, sErr end -- creo piano di taglio sulla testa del tenone e lo lavoro - local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) local AddId = EgtSurfTmPlaneInBBox( EgtGetParent( Proc.Id), ptC, vtN, b3Solid, GDB_RT.GLOB) if AddId then EgtRelocate( AddId, nAddGrpId) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) -- se pezzo piccolo, in coda e piano inclinato attorno a Z applico svuotatura - if b3Solid:getDimX() < 1000 and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 then + if b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 then local sPocketing = ML.FindPocketing( 'OpenPocket') -- inserisco la lavorazione di svuotatura local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) @@ -163,7 +161,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- altrimenti applico taglio di lama else local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, Head = Proc.Head, Tail = Proc.Tail} - local bFromBottom = ( b3Solid:getDimX() < 1000 and vtExtr:getZ() > 0.25) + local bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, 0, bFromBottom) if not bOk then return bOk, sErr end end