3 Commits

Author SHA1 Message Date
andrea.villa 38bb400286 Modifiche ISO all'inizio lavorazione per gestione ripartenza 2026-05-15 08:18:28 +02:00
andrea.villa 39f1fee4cd In caso di ripartenza si aspettano 2 secondi per aspettare caricamento del file dei pinzaggi 2026-05-14 12:15:13 +02:00
andrea.villa 3dc2d709bc Corretta scrittura apeertura chiusura pinze 2026-05-14 09:48:41 +02:00
2 changed files with 152 additions and 150 deletions
+151 -149
View File
@@ -591,85 +591,178 @@ function OnRapid()
--EMT.ZMAX = true
EMT.PREVTOOL = EMT.TOOL
end
-- se si spostano i carrelli, si chiude lavorazione precedente
if bMoveChar then
local bStoPre
if EMT.CHAN2 then
-- MyEmtOutput( 'WAIT_CHAN(2)')
MyEmtOutput( 'STOPRE')
bStoPre = true
EMT.CHAN2 = nil
end
if EMT.TRAILON then
MyEmtOutput( 'TRAILOF(X2,X1)')
MyEmtOutput( 'STOPRE')
MyEmtOutput( 'TRANS')
bStoPre = true
EMT.TRAILON = nil
end
--if not bStoPre then MyEmtOutput( 'STOPRE') end
--MyEmtOutput( '')
end
-- se c'è un movimento carrelli
if bMoveChar then
if not EMT.TSELECT then
EMT.NSTEP = EMT.NSTEP + 10
local sStep = EgtNumToString( EMT.NSTEP, 0)
MyEmtOutput( '_STEP='..sStep)
local sStep1 = EgtNumToString( EMT.NSTEP + 1, 0)
MyEmtOutput( 'GOTOF '..'_N'..sStep1)
local sStep = EgtNumToString( EMT.NSTEP, 0)
MyEmtOutput( '_N'..sStep..':STOPRE')
local sOut = 'PRE_WORK(1,1,' .. EMT.TOOLSEL .. ','..EgtNumToString( EMT.S, 0) ..',,,,)'
MyEmtOutput( sOut)
EMT.SPEED_ON = true
MyEmtOutput( '_N'..sStep1..':STOPRE')
end
MyEmtOutput( 'WAIT_CHAN(2)')
end
EMT.NSTEP = EMT.NSTEP + 10
local sStep = EgtNumToString( EMT.NSTEP, 0)
MyEmtOutput( '_STEP='..sStep)
local sOut = EMT.MCHNAME..'/'..EMT.TOOL
MyEmtOutput( '\n; *** ' .. sOut .. ' ***')
-- movimento carrelli
-- se ci sono movimenti carrelli
EMT.AUXCMD = {}
for i = 1, #EMT.AUXSTR do
MyEmtOutput( EMT.AUXSTR[i])
if EMT.AUXSTR and #EMT.AUXSTR > 0 then
EMT.NSTEP = EMT.NSTEP + 10
local sStep = EgtNumToString( EMT.NSTEP, 0)
MyEmtOutput( '_STEP='..sStep)
for i = 1, #EMT.AUXSTR do
MyEmtOutput( EMT.AUXSTR[i])
end
MyEmtOutput( '_N'..sStep..':STOPRE')
end
EMT.AUXSTR = {}
EMT.POSTROT = false
EMT.RELOAD = false
EMT.RELOAD2 = nil
EMT.CHAN2 = bMoveChar
end
-- se utensile appena selezionato, lo devo dichiarare
if EMT.TSELECT then
EMT.TSELECT = nil
if bMoveChar then
local sStep = EgtNumToString( EMT.NSTEP, 0)
MyEmtOutput( '_N'..sStep..':STOPRE')
end
local sOut = 'PRE_WORK(1,1,' .. EMT.TOOLSEL .. ','..EgtNumToString( EMT.S, 0) ..',,,,)'
MyEmtOutput( sOut)
EMT.SPEED_ON = true
-- eventuali emissioni per ripartenza successiva al carico
elseif bMoveChar then
local sStep1 = EgtNumToString( EMT.NSTEP + 1, 0)
-- gestione ripartenza
EMT.NSTEP = EMT.NSTEP + 10
local sStep = EgtNumToString( EMT.NSTEP, 0)
MyEmtOutput( '_STEP='..sStep)
local sStep1 = EgtNumToString( EMT.NSTEP + 1, 0)
if not EMT.LOAD then
MyEmtOutput( 'GOTOF '..'_N'..sStep1)
local sStep = EgtNumToString( EMT.NSTEP, 0)
MyEmtOutput( '_N'..sStep..':STOPRE')
local sOut = 'PRE_WORK(1,1,' .. EMT.TOOLSEL .. ','..EgtNumToString( EMT.S, 0) ..',,,,)'
MyEmtOutput( sOut)
EMT.SPEED_ON = true
MyEmtOutput( '_N'..sStep1..':STOPRE')
else
local sStep = EgtNumToString( EMT.NSTEP, 0)
MyEmtOutput( '_N'..sStep..':STOPRE')
end
sStep = EgtNumToString( EMT.NSTEP, 0)
MyEmtOutput( '; se ripartenza')
MyEmtOutput( '_N'..sStep..':STOPRE')
local sOut = 'PRE_WORK(1,1,' .. EMT.TOOLSEL .. ','..EgtNumToString( EMT.S, 0) ..',,,,)'
MyEmtOutput( sOut)
-- eventuale avvio mandrino (se non già avviato)
EmitSpeedOn( EMT.S)
-- EmitSpeedOn( EMT.S)
-- si ripete macro di carico con opzione di precarico eseguito
if EMT.LOAD then
MyEmtOutput( EMT.PRELOADCMD)
EMT.PRELOADCMD = nil
end
sOut = 'G1 Y=' .. EgtNumToString( EMT.L2, 3)..' A1='..EgtNumToString( EMT.R2, 3)..' C1='..EgtNumToString( EMT.R1, 3) .. ' F' .. EgtNumToString( FmaxY, 3)
MyEmtOutput( sOut)
if EMT.LOAD then
MyEmtOutput( 'WAIT_CHAN(2)')
EMT.CHAN2 = nil
end
if EMT.X1DELTA and EMT.X2DELTA then
MyEmtOutput( 'GET(X1,X2)')
MyEmtOutput( 'STOPRE')
MyEmtOutput( 'TRAILON(X2,X1)')
EMT.TRAILON = true
elseif EMT.X1DELTA then
MyEmtOutput( 'GET(X1)')
elseif EMT.X2DELTA then
MyEmtOutput( 'GET(X2)')
end
-- se stato pinza attiva non coerente con master, si riscrivono gli assi
if EMT.X1DELTA then
MyEmtOutput( 'GEOAX(1,X1,2,Y1,3,Z1)')
MyEmtOutput( 'G90 G17')
elseif EMT.X2DELTA then
MyEmtOutput( 'GEOAX(1,X2,2,Y1,3,Z1)')
MyEmtOutput( 'G90 G17')
end
if not EMT.LOAD then
local sStep2 = EgtNumToString( EMT.NSTEP + 2, 0)
MyEmtOutput( 'GOTOF '..'_N'..sStep2)
MyEmtOutput( '; ciclo standard')
MyEmtOutput( '_N'..sStep1..':STOPRE')
if EMT.TSELECT then
sOut = 'PRE_WORK(1,1,' .. EMT.TOOLSEL .. ','..EgtNumToString( EMT.S, 0) ..',,,,)'
MyEmtOutput( sOut)
end
if bMoveChar then
sOut = 'G1 Y=' .. EgtNumToString( EMT.L2, 3)..' A1='..EgtNumToString( EMT.R2, 3)..' C1='..EgtNumToString( EMT.R1, 3) .. ' F' .. EgtNumToString( FmaxY, 3)
MyEmtOutput( sOut)
MyEmtOutput( 'WAIT_CHAN(2)')
-- dopo aver spostato i carrelli, lancio precarico
-- se taglio di coda senza residuo da scaricare, emetto macro per accelerare il carico della barra successiva
if EMT.MCHUSERNOTES and EMT.MCHUSERNOTES:find( 'Cut') and not EMT.PRELOAD then
EMT.PRELOAD = true
MyEmtOutput( '_POSIZ_T(4,,,,,,,,,)') -- Lancio macro per carico anticipato: i valori sono presi dal plc (passati dall'interfaccia)
end
EMT.CHAN2 = nil
if EMT.X1DELTA and EMT.X2DELTA then
MyEmtOutput( 'GET(X1,X2)')
MyEmtOutput( 'STOPRE')
MyEmtOutput( 'TRAILON(X2,X1)')
EMT.TRAILON = true
elseif EMT.X1DELTA then
MyEmtOutput( 'GET(X1)')
elseif EMT.X2DELTA then
MyEmtOutput( 'GET(X2)')
end
-- se stato pinza attiva non coerente con master, si riscrivono gli assi
if EMT.X1DELTA or EMT.X2DELTA then
if EMT.X1DELTA and not EMT.X1MASTER then
EMT.X1MASTER = true
MyEmtOutput( 'GEOAX(1,X1,2,Y1,3,Z1)')
MyEmtOutput( 'G90 G17')
elseif EMT.X2DELTA and ( EMT.X1MASTER and not EMT.X1DELTA) then
EMT.X1MASTER = false
MyEmtOutput( 'GEOAX(1,X2,2,Y1,3,Z1)')
MyEmtOutput( 'G90 G17')
end
end
-- primo posizionamento carrello rispetto a 0M
if EMT.X1DELTA then
local dPosX1 = EMT.L1 + EMT.X1DELTA
sOut = 'G1 X' .. EmtLenToString( dPosX1, 3) .. ' F' .. GetClampFeed( EMT.LENGTHBEAM)
MyEmtOutput( sOut)
elseif EMT.X2DELTA then
local dPosX2 = EMT.L1 + EMT.X2DELTA
sOut = 'G1 X' .. EmtLenToString( dPosX2, 3) .. ' F' .. GetClampFeed( EMT.LENGTHBEAM)
MyEmtOutput( sOut)
else
EmtSetLastError( 1213, "Part to machine without charriots")
end
else
-- movimento di tutti gli assi assieme
if EMT.X1DELTA then
local dPosX1 = EMT.L1 + EMT.X1DELTA
sOut = 'G1 X=' .. EmtLenToString( dPosX1, 3) .. ' Y=' .. EgtNumToString( EMT.L2, 3)..
' A1='..EgtNumToString( EMT.R2, 3).. ' C1='..EgtNumToString( EMT.R1, 3).. ' F' .. GetClampFeed( EMT.LENGTHBEAM)
MyEmtOutput( sOut)
elseif EMT.X2DELTA then
local dPosX2 = EMT.L1 + EMT.X2DELTA
sOut = 'G1 X' .. EmtLenToString( dPosX2, 3) .. ' Y=' .. EgtNumToString( EMT.L2, 3)..
' A1='..EgtNumToString( EMT.R2, 3).. ' C1='..EgtNumToString( EMT.R1, 3).. ' F' .. GetClampFeed( EMT.LENGTHBEAM)
MyEmtOutput( sOut)
else
EmtSetLastError( 1213, "Part to machine without charriots")
end
-- se ho lanciato split in modo asincrono, dopo POSIZ_YAC devo attendere
if EMT.WAIT_SPLIT then
MyEmtOutput( 'WAITP(X1)')
EMT.WAIT_SPLIT = nil
end
end
MyEmtOutput( '_N'..sStep2..':STOPRE')
end
-- primo posizionamento testa rispetto a 0M
EmtResetPrev()
-- sega a catena da gestire
@@ -681,99 +774,8 @@ function OnRapid()
-- local dFeedY, dFeedA, dFeedC = CalcFeedYAC( EMT.L2opp - EMT.L2, EMT.R2pp - EMT.R2, EMT.R1pp - EMT.R1)
-- sOut = '_POSIZ_YAC('..EgtNumToString( EMT.L2, 3)..','..EgtNumToString( EMT.R2, 3)..','..EgtNumToString( EMT.R1, 3)..','.. EgtNumToString( FmaxY, 0)..',,)'
-- si ripete macro di carico con opzione di precarico eseguito
if EMT.LOAD then
MyEmtOutput( EMT.PRELOADCMD)
EMT.PRELOADCMD = nil
end
-- se si sono spostati i carrelli
if bMoveChar then
--MyEmtOutput( 'TRANS')
local sOut = 'G1 Y=' .. EgtNumToString( EMT.L2, 3)..' A1='..EgtNumToString( EMT.R2, 3)..' C1='..EgtNumToString( EMT.R1, 3) .. ' F' .. EgtNumToString( FmaxY, 3)
MyEmtOutput( sOut)
end
EMT.LOAD = false
-- se ho lanciato split in modo asincrono, dopo POSIZ_YAC devo attendere
if EMT.WAIT_SPLIT then
MyEmtOutput( 'WAITP(X1)')
EMT.WAIT_SPLIT = nil
end
-- se necessario, attesa fine movimenti carrelli e presa assi relativi
if bMoveChar then
MyEmtOutput( 'WAIT_CHAN(2)')
EMT.CHAN2 = nil
if EMT.X1DELTA and EMT.X2DELTA then
MyEmtOutput( 'GET(X1,X2)')
MyEmtOutput( 'STOPRE')
MyEmtOutput( 'TRAILON(X2,X1)')
EMT.TRAILON = true
elseif EMT.X1DELTA then
MyEmtOutput( 'GET(X1)')
elseif EMT.X2DELTA then
MyEmtOutput( 'GET(X2)')
end
end
-- se stato pinza attiva non coerente con master, si riscrivono gli assi
if EMT.X1DELTA or EMT.X2DELTA then
if EMT.X1DELTA and not EMT.X1MASTER then
EMT.X1MASTER = true
MyEmtOutput( 'GEOAX(1,X1,2,Y1,3,Z1)')
MyEmtOutput( 'G90 G17')
elseif EMT.X2DELTA and ( EMT.X1MASTER and not EMT.X1DELTA) then
EMT.X1MASTER = false
MyEmtOutput( 'GEOAX(1,X2,2,Y1,3,Z1)')
MyEmtOutput( 'G90 G17')
end
end
-- dopo aver spostato i carrelli, lancio precarico
-- se taglio di coda senza residuo da scaricare, emetto macro per accelerare il carico della barra successiva
if EMT.MCHUSERNOTES and EMT.MCHUSERNOTES:find( 'Cut') and not EMT.PRELOAD then
EMT.PRELOAD = true
MyEmtOutput( '_POSIZ_T(4,,,,,,,,,)') -- Lancio macro per carico anticipato: i valori sono presi dal plc (passati dall'interfaccia)
end
-- se si sono mossi i carrelli
if bMoveChar then
-- primo posizionamento carrello rispetto a 0M
if EMT.X1DELTA then
local dPosX1 = EMT.L1 + EMT.X1DELTA
local sOut = 'G1 X' .. EmtLenToString( dPosX1, 3) .. ' F' .. GetClampFeed( EMT.LENGTHBEAM)
MyEmtOutput( sOut)
elseif EMT.X2DELTA then
local dPosX2 = EMT.L1 + EMT.X2DELTA
local sOut = 'G1 X' .. EmtLenToString( dPosX2, 3) .. ' F' .. GetClampFeed( EMT.LENGTHBEAM)
MyEmtOutput( sOut)
else
EmtSetLastError( 1213, "Part to machine without charriots")
end
else
-- MyEmtOutput( 'TRANS')
-- assegnazione assi geometrici (GEOAX)
-- primo posizionamento carrello rispetto a 0M
if EMT.X1DELTA then
local dPosX1 = EMT.L1 + EMT.X1DELTA
local sOut = 'G1 X=' .. EmtLenToString( dPosX1, 3) .. ' Y=' .. EgtNumToString( EMT.L2, 3)..
' A1='..EgtNumToString( EMT.R2, 3).. ' C1='..EgtNumToString( EMT.R1, 3).. ' F' .. GetClampFeed( EMT.LENGTHBEAM)
MyEmtOutput( sOut)
elseif EMT.X2DELTA then
local dPosX2 = EMT.L1 + EMT.X2DELTA
local sOut = 'G1 X' .. EmtLenToString( dPosX2, 3) .. ' Y=' .. EgtNumToString( EMT.L2, 3)..
' A1='..EgtNumToString( EMT.R2, 3).. ' C1='..EgtNumToString( EMT.R1, 3).. ' F' .. GetClampFeed( EMT.LENGTHBEAM)
MyEmtOutput( sOut)
else
EmtSetLastError( 1213, "Part to machine without charriots")
end
end
-- se taglio di separazione prima di scarico a caduta, emissione stop tappeto scarico trucioli
if EMT.PREFALLCUT then
MyEmtOutput( ';M29')
@@ -782,6 +784,7 @@ function OnRapid()
EMT.REFLOC = 0
EMT.MCHFIRST = false
EMT.ZMAX = false
EMT.TSELECT = false
-- se alto in Z (non serve l'avvicinamento finale)
if EMT.FLAG == 2 then
@@ -793,7 +796,6 @@ function OnRapid()
else
MyRestoreAxes()
end
end
-- se standard
if EMT.FLAG == 0 or EMT.FLAG == 1 or EMT.FLAG == 2 then
@@ -1096,7 +1098,7 @@ function PrepareMoveChar( sCmd)
if Cmd[2] == '0' and EMT.X1CLAMP then
EMT.X1CLAMP = nil
table.insert( CLAMP_POS, 'GRIPPER("AP1",,)')
elseif not EMT.X1CLAMP and Cmd[2] ~= '0' then
elseif ( not EMT.X1CLAMP or not EMT.X1DELTA) and Cmd[2] ~= '0' then
EMT.X1CLAMP = true
local sVertClamp = EgtIf( Cmd[2] == '2', '1', '0')
table.insert( CLAMP_POS, 'GRIPPER("CH1",'.. sVertClamp ..',2.5)')
@@ -1105,7 +1107,7 @@ function PrepareMoveChar( sCmd)
if Cmd[2] == '0' and EMT.X2CLAMP then
EMT.X2CLAMP = nil
table.insert( CLAMP_POS, 'GRIPPER("AP2",,)')
elseif not EMT.X2CLAMP and Cmd[2] ~= '0' then
elseif ( not EMT.X2CLAMP or not EMT.X2DELTA) and Cmd[2] ~= '0' then
EMT.X2CLAMP = true
local sVertClamp = EgtIf( Cmd[2] == '2', '1', '0')
table.insert( CLAMP_POS, 'GRIPPER("CH2",'.. sVertClamp ..',2.5)')
@@ -1798,7 +1800,7 @@ function CreateClampingFile()
local nReposNumber = i * 100
local nReposNumber2 = (i + 1) * 100
nfile:write( '\nIF ((_STEP3>=' .. EgtNumToString( nReposNumber) ..') AND (_STEP3<'.. EgtNumToString( nReposNumber2) .. '))\n')
nfile:write( ' IF _STEP3<>' .. EgtNumToString( nReposNumber) ..' GOTOF JUMP3\n')
nfile:write( ' IF _STEP3<>' .. EgtNumToString( nReposNumber) ..'\n G4F2\n GOTOF JUMP3\n ENDIF\n')
local nInternalStep = 0
for j = 1, #ALL_CLAMP_POS[i] do
-- comando speciale per aggiungere etichetta per ripartenza
+1 -1
View File
@@ -9,7 +9,7 @@
require( 'EmtGenerator')
EgtEnableDebug( false)
PP_VER = '3.1e1_DEV1'
PP_VER = '3.1e1_DEV4'
MIN_MACH_VER = '3.1c1'
EgtOutLog ( '** Saomad-KAIROS '..PP_VER..' (MinMach '.. MIN_MACH_VER ..') **', 1)