DataBeam :
- aggiunta gestione conservazione modifiche barra in EgtCAM5 chiamato da TS3.
This commit is contained in:
+240
-196
@@ -1,4 +1,4 @@
|
||||
-- BatchProcess.lua by Egaltech s.r.l. 2019/10/22
|
||||
-- BatchProcess.lua by Egaltech s.r.l. 2019/12/09
|
||||
-- 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.
|
||||
@@ -8,6 +8,7 @@
|
||||
-- 2019/10/04 Migliorato log dei parametri ricevuti.
|
||||
-- 2019/10/07 Aggiunta gestione Flag 4 = Check+Generate.
|
||||
-- 2019/10/09 In ImportBtl aggiunto flag per usare UserAttr.
|
||||
-- 2019/12/09 Gestione conservazione modifiche su barre.
|
||||
|
||||
-- Intestazioni
|
||||
require( 'EgtBase')
|
||||
@@ -118,7 +119,7 @@ if BEAM.FLAG > 10 then
|
||||
return
|
||||
end
|
||||
|
||||
-- Segnalazione avvio
|
||||
-- *** Segnalazione avvio ***
|
||||
EgtOutLog( '*** Beam BatchProcess Start ***', 1)
|
||||
|
||||
-- Carico le librerie
|
||||
@@ -130,214 +131,257 @@ local BL = require( 'BeamLib')
|
||||
local BD = require( 'BeamData')
|
||||
|
||||
-- Verifico il tipo di file
|
||||
local _, _, sExt = EgtSplitPath( BEAM.FILE)
|
||||
local sDir, sTitle, sExt = EgtSplitPath( BEAM.FILE)
|
||||
local bBtl = ( string.upper( sExt or '') ~= '.NGE')
|
||||
|
||||
-- Se Btl, lo importo
|
||||
if bBtl then
|
||||
EgtNewFile()
|
||||
if not EgtImportBtl( BEAM.FILE, EIB_FL.TS3_POS + EIB_FL.USEUATTR) then
|
||||
BEAM.ERR = 13
|
||||
BEAM.MSG = 'Error importing BTL file : ' .. BEAM.FILE
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
end
|
||||
-- altrimenti apro Nge
|
||||
else
|
||||
if not EgtOpenFile( BEAM.FILE) then
|
||||
BEAM.ERR = 13
|
||||
BEAM.MSG = 'Error opening NGE file : ' .. BEAM.FILE
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
end
|
||||
-- faccio copia del file originale
|
||||
local sDir, sTitle, sExt = EgtSplitPath( BEAM.FILE)
|
||||
EgtCopyFile( BEAM.FILE, sDir..sTitle..'.ori'..sExt)
|
||||
end
|
||||
-- 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))
|
||||
|
||||
-- Recupero l'elenco ordinato delle travi
|
||||
local vBeam = {}
|
||||
local nPartId = EgtGetFirstPart()
|
||||
while nPartId do
|
||||
table.insert( vBeam, { Id = nPartId, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))})
|
||||
nPartId = EgtGetNextPart( nPartId)
|
||||
end
|
||||
if #vBeam == 0 then
|
||||
BEAM.ERR = 14
|
||||
BEAM.MSG = 'Error no beams in the file : ' .. BEAM.FILE
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
else
|
||||
local sOut = ''
|
||||
for i = 1, #vBeam do
|
||||
sOut = sOut .. vBeam[i].Name .. ', '
|
||||
end
|
||||
sOut = sOut:sub( 1, -3)
|
||||
EgtOutLog( 'Travi trovate : ' .. sOut, 1)
|
||||
end
|
||||
-- Inizializzo contatori errori e avvisi
|
||||
local nErrCnt = 0
|
||||
local nWarnCnt = 0
|
||||
|
||||
-- Ne recupero le dimensioni
|
||||
for i = 1, #vBeam do
|
||||
local Ls = EgtGetFirstNameInGroup( vBeam[i].Id, 'Box')
|
||||
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
if not b3Solid then
|
||||
BEAM.ERR = 15
|
||||
BEAM.MSG = 'Box undefined for beam ' .. vBeam[i].Name
|
||||
-- Se da elaborare
|
||||
if bToProcess then
|
||||
-- Se Btl, lo importo
|
||||
if bBtl then
|
||||
EgtNewFile()
|
||||
if not EgtImportBtl( BEAM.FILE, EIB_FL.TS3_POS + EIB_FL.USEUATTR) then
|
||||
BEAM.ERR = 13
|
||||
BEAM.MSG = 'Error importing BTL file : ' .. BEAM.FILE
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
end
|
||||
-- faccio copia del file originale
|
||||
EgtCopyFile( BEAM.FILE, sDir..sTitle..'.ori'..sExt)
|
||||
-- altrimenti Nge, lo apro
|
||||
else
|
||||
if not EgtOpenFile( BEAM.FILE) then
|
||||
BEAM.ERR = 13
|
||||
BEAM.MSG = 'Error opening NGE file : ' .. BEAM.FILE
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
end
|
||||
-- faccio copia del file originale
|
||||
EgtCopyFile( BEAM.FILE, sDir..sTitle..'.ori'..sExt)
|
||||
end
|
||||
|
||||
-- Recupero l'elenco ordinato delle travi
|
||||
local vBeam = {}
|
||||
local nPartId = EgtGetFirstPart()
|
||||
while nPartId do
|
||||
table.insert( vBeam, { Id = nPartId, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))})
|
||||
nPartId = EgtGetNextPart( nPartId)
|
||||
end
|
||||
if #vBeam == 0 then
|
||||
BEAM.ERR = 14
|
||||
BEAM.MSG = 'Error no beams in the file : ' .. BEAM.FILE
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
else
|
||||
vBeam[i].Box = b3Solid
|
||||
local sOut = ''
|
||||
for i = 1, #vBeam do
|
||||
sOut = sOut .. vBeam[i].Name .. ', '
|
||||
end
|
||||
sOut = sOut:sub( 1, -3)
|
||||
EgtOutLog( 'Travi trovate : ' .. sOut, 1)
|
||||
end
|
||||
end
|
||||
|
||||
-- Ne recupero la posizione
|
||||
for i = 1, #vBeam do
|
||||
local PosX = EgtGetInfo( vBeam[i].Id, 'POSX', 'd')
|
||||
vBeam[i].PosX = PosX
|
||||
end
|
||||
|
||||
-- Eseguo eventuali rotazioni e inversioni testa-coda
|
||||
for i = 1, #vBeam do
|
||||
local b3Solid = vBeam[i].Box
|
||||
-- rotazione
|
||||
local dRotAng = EgtGetInfo( vBeam[i].Id, 'ROTATED', 'd')
|
||||
if dRotAng and abs( dRotAng) > GEO.EPS_ANG_SMALL then
|
||||
local ptRotCen = b3Solid:getCenter()
|
||||
EgtRotate( vBeam[i].Id, ptRotCen, X_AX(), dRotAng, GDB_RT.GLOB)
|
||||
b3Solid:rotate( ptRotCen, X_AX(), dRotAng)
|
||||
|
||||
-- Ne recupero le dimensioni
|
||||
for i = 1, #vBeam do
|
||||
local Ls = EgtGetFirstNameInGroup( vBeam[i].Id, 'Box')
|
||||
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
if not b3Solid then
|
||||
BEAM.ERR = 15
|
||||
BEAM.MSG = 'Box undefined for beam ' .. vBeam[i].Name
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
else
|
||||
vBeam[i].Box = b3Solid
|
||||
end
|
||||
end
|
||||
-- inversione
|
||||
local dInvAng = 180 - ( EgtGetInfo( vBeam[i].Id, 'INVERTED', 'd') or 0)
|
||||
if abs( dInvAng) > GEO.EPS_ANG_SMALL then
|
||||
local ptInvCen = b3Solid:getCenter()
|
||||
EgtRotate( vBeam[i].Id, ptInvCen, Z_AX(), dInvAng, GDB_RT.GLOB)
|
||||
|
||||
-- Ne recupero la posizione
|
||||
for i = 1, #vBeam do
|
||||
local PosX = EgtGetInfo( vBeam[i].Id, 'POSX', 'd')
|
||||
vBeam[i].PosX = PosX
|
||||
end
|
||||
end
|
||||
|
||||
-- Ne verifico le dimensioni
|
||||
local dRawW = vBeam[1].Box:getDimY()
|
||||
local dRawH = vBeam[1].Box:getDimZ()
|
||||
local vBeamErr = {}
|
||||
for i = 2, #vBeam do
|
||||
local dDimW = vBeam[i].Box:getDimY()
|
||||
local dDimH = vBeam[i].Box:getDimZ()
|
||||
if ( abs( dDimW - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimH - dRawH) > 10 * GEO.EPS_SMALL) and
|
||||
( abs( dDimH - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimW - dRawH) > 10 * GEO.EPS_SMALL) then
|
||||
table.insert( vBeamErr, i)
|
||||
|
||||
-- Eseguo eventuali rotazioni e inversioni testa-coda
|
||||
for i = 1, #vBeam do
|
||||
local b3Solid = vBeam[i].Box
|
||||
-- rotazione
|
||||
local dRotAng = EgtGetInfo( vBeam[i].Id, 'ROTATED', 'd')
|
||||
if dRotAng and abs( dRotAng) > GEO.EPS_ANG_SMALL then
|
||||
local ptRotCen = b3Solid:getCenter()
|
||||
EgtRotate( vBeam[i].Id, ptRotCen, X_AX(), dRotAng, GDB_RT.GLOB)
|
||||
b3Solid:rotate( ptRotCen, X_AX(), dRotAng)
|
||||
end
|
||||
-- inversione
|
||||
local dInvAng = 180 - ( EgtGetInfo( vBeam[i].Id, 'INVERTED', 'd') or 0)
|
||||
if abs( dInvAng) > GEO.EPS_ANG_SMALL then
|
||||
local ptInvCen = b3Solid:getCenter()
|
||||
EgtRotate( vBeam[i].Id, ptInvCen, Z_AX(), dInvAng, GDB_RT.GLOB)
|
||||
end
|
||||
end
|
||||
end
|
||||
if #vBeamErr > 0 then
|
||||
local sOut = 'Rimosse travi con sezioni diverse dalla prima :\n'
|
||||
for i = #vBeamErr, 1, -1 do
|
||||
sOut = sOut .. vBeam[vBeamErr[i]].Name .. '\n'
|
||||
table.remove( vBeam, vBeamErr[i])
|
||||
|
||||
-- Ne verifico le dimensioni
|
||||
local dRawW = vBeam[1].Box:getDimY()
|
||||
local dRawH = vBeam[1].Box:getDimZ()
|
||||
local vBeamErr = {}
|
||||
for i = 2, #vBeam do
|
||||
local dDimW = vBeam[i].Box:getDimY()
|
||||
local dDimH = vBeam[i].Box:getDimZ()
|
||||
if ( abs( dDimW - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimH - dRawH) > 10 * GEO.EPS_SMALL) and
|
||||
( abs( dDimH - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimW - dRawH) > 10 * GEO.EPS_SMALL) then
|
||||
table.insert( vBeamErr, i)
|
||||
end
|
||||
end
|
||||
BEAM.ERR = 16
|
||||
BEAM.MSG = sOut
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
end
|
||||
|
||||
-- Verifico sezione barra non troppo grande
|
||||
if dRawW > BD.MAX_WIDTH + 10 * GEO.EPS_SMALL or dRawH > BD.MAX_HEIGHT + 10 * GEO.EPS_SMALL then
|
||||
local sOut = 'Sezione (' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' ..
|
||||
'oltre i limiti della macchina (' .. EgtNumToString( BD.MAX_WIDTH, 2) .. ' x ' .. EgtNumToString( BD.MAX_HEIGHT, 2) .. ')'
|
||||
BEAM.ERR = 17
|
||||
BEAM.MSG = sOut
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
end
|
||||
|
||||
-- Verifico sezione barra non troppo piccola
|
||||
if dRawW < BD.MIN_WIDTH - 10 * GEO.EPS_SMALL or dRawH < BD.MIN_HEIGHT - 10 * GEO.EPS_SMALL then
|
||||
local sOut = 'Sezione (' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' ..
|
||||
'sotto i limiti della macchina (' .. EgtNumToString( BD.MIN_WIDTH, 2) .. ' x ' .. EgtNumToString( BD.MIN_HEIGHT, 2) .. ')'
|
||||
BEAM.ERR = 17
|
||||
BEAM.MSG = sOut
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
end
|
||||
|
||||
-- Lunghezza della barra
|
||||
local dRawL = EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'BARLEN', 'd') or 12000
|
||||
-- Sovramateriale di testa
|
||||
local dOvmHead = vBeam[1].PosX or 10
|
||||
|
||||
-- Sistemo le travi nel grezzo
|
||||
local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam)
|
||||
if not bPbOk then
|
||||
BEAM.ERR = 18
|
||||
BEAM.MSG = sPbErr
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
end
|
||||
|
||||
-- Imposto Nome file CN
|
||||
local _, sName, _ = EgtSplitPath( BEAM.FILE)
|
||||
EgtSetInfo( EgtGetCurrMachGroup(), 'NcName', sName .. '.cnc')
|
||||
|
||||
-- Abilito Vmill
|
||||
EgtSetInfo( EgtGetCurrMachGroup(), 'Vm', '1')
|
||||
|
||||
-- Lavoro le features
|
||||
local bPfOk, Stats = BE.ProcessFeatures()
|
||||
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
|
||||
BEAM.ERR = 0
|
||||
BEAM.MSG = '---'
|
||||
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
|
||||
nErrCnt = nErrCnt + 1
|
||||
sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg)
|
||||
BEAM.ERR = 19
|
||||
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( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg)
|
||||
BEAM.ERR = -19
|
||||
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)
|
||||
if #vBeamErr > 0 then
|
||||
local sOut = 'Rimosse travi con sezioni diverse dalla prima :\n'
|
||||
for i = #vBeamErr, 1, -1 do
|
||||
sOut = sOut .. vBeam[vBeamErr[i]].Name .. '\n'
|
||||
table.remove( vBeam, vBeamErr[i])
|
||||
end
|
||||
BEAM.ERR = 16
|
||||
BEAM.MSG = sOut
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
end
|
||||
|
||||
-- Verifico sezione barra non troppo grande
|
||||
if dRawW > BD.MAX_WIDTH + 10 * GEO.EPS_SMALL or dRawH > BD.MAX_HEIGHT + 10 * GEO.EPS_SMALL then
|
||||
local sOut = 'Sezione (' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' ..
|
||||
'oltre i limiti della macchina (' .. EgtNumToString( BD.MAX_WIDTH, 2) .. ' x ' .. EgtNumToString( BD.MAX_HEIGHT, 2) .. ')'
|
||||
BEAM.ERR = 17
|
||||
BEAM.MSG = sOut
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
end
|
||||
|
||||
-- Verifico sezione barra non troppo piccola
|
||||
if dRawW < BD.MIN_WIDTH - 10 * GEO.EPS_SMALL or dRawH < BD.MIN_HEIGHT - 10 * GEO.EPS_SMALL then
|
||||
local sOut = 'Sezione (' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' ..
|
||||
'sotto i limiti della macchina (' .. EgtNumToString( BD.MIN_WIDTH, 2) .. ' x ' .. EgtNumToString( BD.MIN_HEIGHT, 2) .. ')'
|
||||
BEAM.ERR = 17
|
||||
BEAM.MSG = sOut
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
end
|
||||
|
||||
-- Lunghezza della barra
|
||||
local dRawL = EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'BARLEN', 'd') or 12000
|
||||
-- Sovramateriale di testa
|
||||
local dOvmHead = vBeam[1].PosX or 10
|
||||
|
||||
-- Sistemo le travi nel grezzo
|
||||
local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam)
|
||||
if not bPbOk then
|
||||
BEAM.ERR = 18
|
||||
BEAM.MSG = sPbErr
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
end
|
||||
|
||||
-- Imposto Nome file CN
|
||||
local _, sName, _ = EgtSplitPath( BEAM.FILE)
|
||||
EgtSetInfo( EgtGetCurrMachGroup(), 'NcName', sName .. '.cnc')
|
||||
|
||||
-- Abilito Vmill
|
||||
EgtSetInfo( EgtGetCurrMachGroup(), 'Vm', '1')
|
||||
|
||||
-- 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)
|
||||
if Stats[i].Err == 0 then
|
||||
BEAM.ERR = 0
|
||||
BEAM.MSG = '---'
|
||||
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
|
||||
nErrCnt = nErrCnt + 1
|
||||
sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg)
|
||||
BEAM.ERR = 19
|
||||
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( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg)
|
||||
BEAM.ERR = -19
|
||||
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
|
||||
EgtSaveFile( sNgeFile)
|
||||
|
||||
-- Visualizzazione avvisi o errori
|
||||
if #sOutput > 0 then EgtOutLog( sOutput) end
|
||||
if nErrCnt > 0 then
|
||||
PostErrView( 19, sOutput)
|
||||
return
|
||||
elseif nWarnCnt > 0 then
|
||||
PostWarnView( 19, sOutput)
|
||||
end
|
||||
|
||||
-- Altrimenti carico il progetto salvato e dichiaro nessun errore
|
||||
else
|
||||
-- Carico il progetto già fatto
|
||||
EgtOpenFile( sNgeFile)
|
||||
-- Dichiaro nessun errore
|
||||
local nPartId = EgtGetFirstPart()
|
||||
while nPartId do
|
||||
local nCutId = EgtGetInfo( nPartId, 'CUTID')
|
||||
if nCutId then
|
||||
local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nPartId, 'Processings') or GDB_ID.NULL)
|
||||
while nProcId do
|
||||
local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC')
|
||||
local nTaskId = EgtGetInfo( nProcId, 'TASKID')
|
||||
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
|
||||
nPartId = EgtGetNextPart( nPartId)
|
||||
end
|
||||
-- Passo in modalità lavora
|
||||
EgtSetCurrMachGroup()
|
||||
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)
|
||||
return
|
||||
elseif nWarnCnt > 0 then
|
||||
PostWarnView( 19, sOutput)
|
||||
end
|
||||
|
||||
-- Se verifica, eseguo simulazione in cieco
|
||||
-- *** Eseguo simulazione in cieco *** ( se richiesta verifica)
|
||||
if ( BEAM.FLAG == 3 or BEAM.FLAG == 4) and bVerifyCollision then
|
||||
local bSimOk, nErr, sErr = EgtSimulate()
|
||||
if not bSimOk then
|
||||
@@ -371,7 +415,7 @@ if ( BEAM.FLAG == 3 or BEAM.FLAG == 4) and bVerifyCollision then
|
||||
end
|
||||
end
|
||||
|
||||
-- Genero programma CN, se richiesto
|
||||
-- *** Genero programma CN *** ( se richiesto)
|
||||
if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
|
||||
if not EgtGenerate( '', 'EgtCAM5 - ' .. sNgeFile) then
|
||||
BEAM.ERR = 20
|
||||
@@ -382,7 +426,7 @@ if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
|
||||
end
|
||||
end
|
||||
|
||||
-- Eseguo stima tempi
|
||||
-- *** Eseguo stima tempi ***
|
||||
if not EgtEstimate( '', 'EgtCAM5 - ' .. sNgeFile) then
|
||||
BEAM.ERR = 21
|
||||
BEAM.MSG = 'Error estimating production time : ' .. sName
|
||||
|
||||
Reference in New Issue
Block a user