DataBeam :
- modificato BatchNew per gestione errori come Wall - modifica a tagli per decisione se fare cubetti.
This commit is contained in:
+54
-37
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user