DataBeam :
- correzioni e migliorie varie.
This commit is contained in:
+31
-16
@@ -1,4 +1,4 @@
|
||||
-- BatchProcess.lua by Egaltech s.r.l. 2019/07/24
|
||||
-- BatchProcess.lua by Egaltech s.r.l. 2019/07/25
|
||||
-- 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.
|
||||
@@ -10,6 +10,12 @@ require( 'EgtBase')
|
||||
_ENV = EgtProtectGlobal()
|
||||
EgtEnableDebug( false)
|
||||
|
||||
-- Per test
|
||||
--BEAM = {}
|
||||
--BEAM.FILE = 'c:\\TechnoEssetre7\\EgtBtl\\Part_15_116.btl'
|
||||
--BEAM.MACHINE = 'FAST'
|
||||
--BEAM.FLAG = 3
|
||||
|
||||
-- Flag abilitazione controllo collisione
|
||||
local bVerifyCollision = true
|
||||
|
||||
@@ -42,7 +48,7 @@ local function PostErrView( nErr, sMsg)
|
||||
if nErr ~= 0 and ( BEAM.FLAG == 1 or BEAM.FLAG == 2) then
|
||||
EgtSetView( SCE_VD.ISO_SW, false)
|
||||
EgtZoom( SCE_ZM.ALL)
|
||||
EgtOutBox( sMsg .. ' (error ' .. tostring( nErr) .. ')', 'BatchProcess', 'ERRORS')
|
||||
EgtOutBox( sMsg, 'BatchProcess (err=' .. tostring( nErr) .. ')', 'ERRORS')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -51,7 +57,7 @@ local function PostWarnView( nWarn, sMsg)
|
||||
if nWarn ~= 0 and ( BEAM.FLAG == 1 or BEAM.FLAG == 2) then
|
||||
EgtSetView( SCE_VD.ISO_SW, false)
|
||||
EgtZoom( SCE_ZM.ALL)
|
||||
EgtOutBox( sMsg .. ' (warning ' .. tostring( nWarn) .. ')', 'BatchProcess', 'WARNINGS')
|
||||
EgtOutBox( sMsg, 'BatchProcess (wrn=' .. tostring( nErr) .. ')', 'WARNINGS')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -236,8 +242,10 @@ local nErrCnt = 0
|
||||
local nWarnCnt = 0
|
||||
local sOutput = ''
|
||||
for i = 1, #Stats do
|
||||
local sMsg = Stats[i].Msg
|
||||
sMsg = string.gsub( sMsg, '\n', ' ', 10)
|
||||
sMsg = string.gsub( sMsg, '\r', ' ', 10)
|
||||
if Stats[i].Err == 0 then
|
||||
sOutput = sOutput .. string.format( 'Cut=%d Tsk=%d Ok\n', Stats[i].CutId, Stats[i].TaskId)
|
||||
BEAM.ERR = 0
|
||||
BEAM.MSG = '---'
|
||||
BEAM.ROT = Stats[i].Rot or 0
|
||||
@@ -246,24 +254,30 @@ for i = 1, #Stats do
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
|
||||
elseif Stats[i].Err > 0 then
|
||||
nErrCnt = nErrCnt + 1
|
||||
sOutput = sOutput .. string.format( 'Cut=%d Tsk=%d %s\n', Stats[i].CutId, Stats[i].TaskId, Stats[i].Msg)
|
||||
sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg)
|
||||
BEAM.ERR = 19
|
||||
BEAM.MSG = Stats[i].Msg
|
||||
BEAM.MSG = sMsg
|
||||
BEAM.ROT = Stats[i].Rot or 0
|
||||
BEAM.CUTID = Stats[i].CutId
|
||||
BEAM.TASKID = Stats[i].TaskId
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
|
||||
elseif Stats[i].Err < 0 then
|
||||
nWarnCnt = nWarnCnt + 1
|
||||
sOutput = sOutput .. string.format( 'Cut=%d Tsk=%d %s\n', Stats[i].CutId, Stats[i].TaskId, Stats[i].Msg)
|
||||
sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg)
|
||||
BEAM.ERR = -19
|
||||
BEAM.MSG = Stats[i].Msg
|
||||
BEAM.MSG = sMsg
|
||||
BEAM.ROT = Stats[i].Rot or 0
|
||||
BEAM.CUTID = Stats[i].CutId
|
||||
BEAM.TASKID = Stats[i].TaskId
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
|
||||
end
|
||||
end
|
||||
|
||||
-- Salvo il progetto
|
||||
local sNgeFile = EgtChangePathExtension( BEAM.FILE, '.nge')
|
||||
EgtSaveFile( sNgeFile)
|
||||
|
||||
-- Visualizzazione avvisi o errori
|
||||
if #sOutput > 0 then EgtOutLog( sOutput) end
|
||||
if nErrCnt > 0 then
|
||||
PostErrView( 19, sOutput)
|
||||
@@ -272,10 +286,6 @@ elseif nWarnCnt > 0 then
|
||||
PostWarnView( 19, sOutput)
|
||||
end
|
||||
|
||||
-- Salvo il progetto
|
||||
local sNgeFile = EgtChangePathExtension( BEAM.FILE, '.nge')
|
||||
EgtSaveFile( sNgeFile)
|
||||
|
||||
-- Genero programma CN, se richiesto
|
||||
if BEAM.FLAG == 0 then
|
||||
if not EgtGenerate( '', 'EgtCAM5 - ' .. sNgeFile) then
|
||||
@@ -303,12 +313,17 @@ EgtOutLog( sTime)
|
||||
if BEAM.FLAG == 3 and bVerifyCollision then
|
||||
local bSimOk, nErr, sErr = EgtSimulate()
|
||||
if not bSimOk then
|
||||
BEAM.ERR = 22
|
||||
if nErr == MCH_SHE.OUTSTROKE then
|
||||
BEAM.MSG = 'Axis outstroke ' .. sErr
|
||||
elseif nErr == MCH_SHE.COLLISION then
|
||||
if nErr == MCH_SHE.COLLISION then
|
||||
BEAM.ERR = 22
|
||||
BEAM.MSG = 'Head-part collision'
|
||||
elseif nErr == MCH_SHE.OUTSTROKE then
|
||||
BEAM.ERR = 23
|
||||
BEAM.MSG = 'Axis outstroke ' .. sErr
|
||||
elseif nErr == MCH_SHE.SPECIAL then
|
||||
BEAM.ERR = 24
|
||||
BEAM.MSG = 'Charriot error ' .. sErr
|
||||
else
|
||||
BEAM.ERR = 25
|
||||
BEAM.MSG = 'General failure (contact supplier)'
|
||||
end
|
||||
BEAM.ROT = 0
|
||||
|
||||
Reference in New Issue
Block a user