diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index 3943243..a0b9e6e 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -1,4 +1,4 @@ --- BatchProcessNew.lua by Egaltech s.r.l. 2022/01/07 +-- BatchProcessNew.lua by Egaltech s.r.l. 2022/02/09 -- Gestione calcolo batch disposizione e lavorazioni per Travi -- 2021/01/07 Per nuova interfaccia Egt. -- 2021/01/15 CREATE_BAR ora FLAG = 6 (prima 5). @@ -8,6 +8,7 @@ -- 2021/06/16 Se disponibile si aggiunge la versione dell'eseguibile alle info del programma CN. -- 2021/08/04 Direzione vista simulazione da BD.SIMUL_VIEW_DIR se esiste. -- 2022/01/07 Per CUTID/TASKID senza ToProcess si verificano anche eventuali Duplo. +-- 2022/02/09 Aggiornato come Wall per gestione errori e verifica attrezzaggio utensili. -- Intestazioni require( 'EgtBase') @@ -193,7 +194,7 @@ if bToProcess then return end -- Faccio copia del file originale - EgtCopyFile( BEAM.FILE, sDir..sTitle..'.ori'..sExt) + EgtCopyFile( BEAM.FILE, sOriFile) -- Aggiorno eventuali dati ausiliari --UpdateAuxData( sBtmFile) @@ -286,11 +287,10 @@ if bToProcess then table.insert( vBeam, { Id = nPartId, PosX = dPosX, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))}) end if #vBeam == 0 then - --BEAM.ERR = 14 - --BEAM.MSG = 'Error : no beams in the project' - --WriteErrToLogFile( BEAM.ERR, BEAM.MSG) - --return - EgtOutLog( 'Travi non trovate', 1) + BEAM.ERR = 14 + BEAM.MSG = 'Error : no beams in the project' + WriteErrToLogFile( BEAM.ERR, BEAM.MSG) + return else local sOut = '' for i = 1, #vBeam do @@ -455,13 +455,16 @@ if bToProcess then -- Abilito Vmill EgtSetInfo( EgtGetCurrMachGroup(), 'Vm', '1') + -- Aggiorno Setup utensili + EgtImportSetup() + -- Lavoro le features local bPfOk, Stats = BE.ProcessFeatures() local sOutput = '' for i = 1, #Stats do local sMsg = Stats[i].Msg - sMsg = string.gsub( sMsg, '\n', ' ', 10) - sMsg = string.gsub( sMsg, '\r', ' ', 10) + sMsg = string.gsub( sMsg or '', '\n', ' ', 10) + sMsg = string.gsub( sMsg or '', '\r', ' ', 10) if Stats[i].Err == 0 then BEAM.ERR = 0 BEAM.MSG = '---' @@ -519,33 +522,33 @@ else -- Carico il progetto già fatto EgtOpenFile( sNgeFile) -- Dichiaro nessun errore - local nPartId = EgtGetFirstPart() - while nPartId do - local vDup = EgtDuploList( nPartId) - if not vDup or #vDup == 0 then - vDup = { nPartId} - end - for i = 1, #vDup do - local nCutId = EgtGetInfo( vDup[i], 'CUTID', 'i') - if nCutId then - local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( vDup[i], 'Processings') or GDB_ID.NULL) - while nProcId do - local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC') - local nTaskId = EgtGetInfo( nProcId, 'TASKID', 'i') - if bIsFea and nTaskId then - BEAM.ERR = 0 - BEAM.MSG = '---' - BEAM.ROT = 0 - BEAM.CUTID = nCutId - BEAM.TASKID = nTaskId - WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) - end - nProcId = EgtGetNext( nProcId) - end - end - end - nPartId = EgtGetNextPart( nPartId) - end + --local nPartId = EgtGetFirstPart() + --while nPartId do + -- local vDup = EgtDuploList( nPartId) + -- if not vDup or #vDup == 0 then + -- vDup = { nPartId} + -- end + -- for i = 1, #vDup do + -- local nCutId = EgtGetInfo( vDup[i], 'CUTID', 'i') + -- if nCutId then + -- local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( vDup[i], 'Processings') or GDB_ID.NULL) + -- while nProcId do + -- local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC') + -- local nTaskId = EgtGetInfo( nProcId, 'TASKID', 'i') + -- if bIsFea and nTaskId then + -- BEAM.ERR = 0 + -- BEAM.MSG = '---' + -- BEAM.ROT = 0 + -- BEAM.CUTID = nCutId + -- BEAM.TASKID = nTaskId + -- WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) + -- end + -- nProcId = EgtGetNext( nProcId) + -- end + -- end + -- end + -- nPartId = EgtGetNextPart( nPartId) + --end -- Aggiorno eventuali dati ausiliari --UpdateAuxData( sBtmFile) -- Passo in modalità lavora @@ -565,6 +568,20 @@ end -- *** Eseguo simulazione con verifica collisione in cieco *** if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.FLAG == 4 then EgtOutLog( ' +++ Simulating with collision check >>>') + -- verifico setup + local bSetUpOk, SetUpErrors = EgtVerifyCurrSetup() + if not bSetUpOk then + local sToolsList = "" + for ToolIndex = 1, #SetUpErrors do + sToolsList = sToolsList .. SetUpErrors[ToolIndex] + if ToolIndex ~= #SetUpErrors then + sToolsList = sToolsList .. ", " + end + end + WriteErrToLogFile( 19, 'Error in setup: tool/s ' .. sToolsList .. ' not found', 0, 0, 0) + return + end + -- lancio simulazione local bSimOk, nErr, sErr = EgtSimulate() if not bSimOk then if nErr == MCH_SHE.INIT then @@ -631,7 +648,7 @@ local Ttot = EgtGetInfo( EgtGetCurrMachGroup(), 'Ttot', 'd') local sTime = 'Total Time = ' .. EgtNumToString( Ttot, 1) EgtOutLog( sTime) --- Imposto la vista ISO 3d, se richiesto +-- Se modifica o simula, imposto la vista ISO 3d opportuna if BEAM.FLAG == 1 or BEAM.FLAG == 2 then local vView = { SCE_VD.ISO_NW, SCE_VD.ISO_SW, SCE_VD.ISO_NE, SCE_VD.ISO_SE} local nV = min( max( BD.SIMUL_VIEW_DIR or 2, 1), 4) diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 8774ec9..2e96d37 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -236,7 +236,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) -- limiti di taglio (se molto di lato e inclinati sono permessi fino a -45deg) local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw) - if not BD.C_SIMM and abs( vtN:getY()) > 0.25 then dNzLimDwnUp = -0.708 end + if not BD.C_SIMM and abs( vtN:getY()) > 0.49 then dNzLimDwnUp = -0.708 end local bDownCut = ( vtN:getZ() <= dNzLimDwnUp) if bFromBottom == nil then bFromBottom = ( vtN:getZ() > 0.25 and b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and vtN:getX() < 0) @@ -320,7 +320,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b -- verifico se necessari tagli supplementari EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3) local vCuts = {} - if not Proc.AdvTail and ( dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then + if not Proc.AdvTail and + ( ( dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > BD.MAX_LEN_DICE) and + ( dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or bDownCut or dCutH > BD.MAX_LEN_DICE)) then local ptExtra, vtExtra local bAutoCalcSurf = true if bFillAreaPiece or bFillTail then