10 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
andrea.villa 779e049eca - Sistemati codici per ripartenze
- Aggiunti movimenti simulazione cambio utensile
2026-05-12 08:25:15 +02:00
andrea.villa 938c9fc536 - Scarico diviso in più chiamate per gestire ripartenza
- variabili OFS_T5_X1 diventano OFS_TS1_X1
2026-05-11 16:40:39 +02:00
andrea.villa 24b5d0190b Aggiunta attesa canale 2 in caso di riposizionamento dei carrelli 2026-04-30 13:10:32 +02:00
andrea.villa 4454073970 Modificata posizione di scarico 2026-04-30 08:33:11 +02:00
andrea.villa e729a12c2d Migliorata emissione TRANS e STOPRE 2026-04-30 08:21:17 +02:00
andrea.villa 169476cb43 - Se c'è un restante, l'ultimo pezzo scaricato con POSIZ_T(6) su processo 2
- Il restante scaricato con macro POSIZ_T(5) su processo 1 che permette di lanciare il precarico su processo 2
2026-04-29 18:11:59 +02:00
andrea.villa cc817a8d39 Merge remote-tracking branch 'origin/NewLink' into develop 2026-04-29 11:11:25 +02:00
4 changed files with 359 additions and 275 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ local Offsets = {
MAX_X2=-62,
PARK_X2=-500,
BEAM_LOAD=1800.0,
BEAM_UNLOAD=-2060,
BEAM_UNLOAD=-2150,
TURN_OFFS=0,
MILL_PIVOT=-211.00,
TAB_OFFSET_Y=0,
+330 -264
View File
@@ -358,6 +358,11 @@ function OnMachiningEnd()
--for i = 1, #EMT.AUXCMD do
-- MyEmtOutput( '( ' .. EMT.AUXCMD[i] .. ' )')
--end
-- sincronizzazione e reset piano
MyEmtOutput( 'STOPRE')
MyEmtOutput( 'TRANS')
EMT.AUXCMD = {}
if #EMT.AUXSTR > 0 then
if EMT.AUXTYPE == 'S' then
@@ -372,8 +377,6 @@ function OnMachiningEnd()
-- EmitSpeedOff()
end
MyEmtOutput( ';PART UNLOAD')
MyEmtOutput( 'STOPRE')
MyEmtOutput( 'TRANS')
elseif EMT.AUXTYPE == 'P' then
if EMT.PREROT then
@@ -580,7 +583,7 @@ function OnRapid()
-- MyEmtOutput( sOut)
-- prima lavorazione
local sOut = EMT.MCHNAME..'/'..EMT.TOOL
MyEmtOutput( '; *** ' .. sOut .. ' ***')
MyEmtOutput( '\n; *** ' .. sOut .. ' ***')
-- altri casi
else
if not EMT.RELOAD and not EMT.ZMAX and #EMT.AUXSTR > 0 then
@@ -588,72 +591,180 @@ 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
EMT.NSTEP = EMT.NSTEP + 10
local sStep = EgtNumToString( EMT.NSTEP, 0)
MyEmtOutput( '_STEP='..sStep)
local sOut = EMT.MCHNAME..'/'..EMT.TOOL
MyEmtOutput( '; *** ' .. sOut .. ' ***')
-- movimento carrelli
MyEmtOutput( '\n; *** ' .. sOut .. ' ***')
-- 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')
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()
local sOut
--if EMT.ZMAX then
-- sOut = 'SUPA G0 D0 Z'..EgtNumToString( ParkZ, 3)
--else
-- -- sOut = 'SUPA G0 D0' .. EmtGetAxis( 'L3')
--end
MyEmtOutput( sOut)
-- sega a catena da gestire
if EMT.HEAD == 'H3' then
MyEmtOutput( '!!! Chainsaw start movements to be calculated !!!')
@@ -663,105 +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
sOut = 'TRANS'
MyEmtOutput( sOut)
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
sOut = 'WAITP(X1)'
MyEmtOutput( sOut)
EMT.WAIT_SPLIT = nil
end
-- se necessario, attesa fine movimenti carrelli e presa assi relativi
if bMoveChar then
sOut = 'WAIT_CHAN(2)'
MyEmtOutput( sOut)
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
-- assegnazione assi geometrici (GEOAX)
MyEmtOutput( 'TRANS')
-- 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
sOut = 'GEOAX(1,X1,2,Y1,3,Z1)'
EMT.X1MASTER = true
MyEmtOutput( sOut)
MyEmtOutput( 'G90 G17')
elseif EMT.X2DELTA and ( EMT.X1MASTER and not EMT.X1DELTA) then
sOut = 'GEOAX(1,X2,2,Y1,3,Z1)'
EMT.X1MASTER = false
MyEmtOutput( sOut)
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
sOut = '_POSIZ_T(4,,,,,,,,,)' -- Lancio macro per carico anticipato: i valori sono presi dal plc (passati dall'interfaccia)
MyEmtOutput( sOut)
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
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
-- primo posizionamento carrello rispetto a 0M
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
end
-- se taglio di separazione prima di scarico a caduta, emissione stop tappeto scarico trucioli
if EMT.PREFALLCUT then
MyEmtOutput( ';M29')
@@ -770,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
@@ -781,7 +796,6 @@ function OnRapid()
else
MyRestoreAxes()
end
end
-- se standard
if EMT.FLAG == 0 or EMT.FLAG == 1 or EMT.FLAG == 2 then
@@ -1084,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)')
@@ -1093,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)')
@@ -1130,114 +1144,142 @@ end
---------------------------------------------------------------------
function PrepareResidue( sCmd)
local Cmd = EgtSplitString( sCmd)
if Cmd[1] == '0' then
-- se non è scarico
if Cmd[2] ~= 'Unloading' then
-- se inizio
if EMT.AUXIND <= 2 then
-- reset stato
EMT.MCIND = 0
EMT.X1STAT = 0
EMT.X2STAT = 0
EMT.MCX1 = {}
EMT.MCX2 = {}
-- se terminato posizionamenti e si deve scaricare
if EMT.UNL then
if Cmd[1] == '0' then
elseif Cmd[1] == '1' then
if Cmd[2] ~= 'Z' then
EMT.NSTEP = EMT.NSTEP + 10
local sStep = EgtNumToString( EMT.NSTEP, 0)
local sOut = '_STEP='..sStep
table.insert( EMT.AUXSTR, sOut)
local sX2Pos = Cmd[3]
sOut = string.format( 'G1 X=%s F=%d', sX2Pos, EMT.FMAXPINZE)
table.insert( EMT.AUXSTR, sOut)
sOut = '_POSIZ_T(5,,,,,2,,,,)' -- attiva spintore scarico pezzo restanto su processo 1
table.insert( EMT.AUXSTR, sOut)
sOut = '_N'..sStep..':STOPRE\n'
table.insert( EMT.AUXSTR, sOut)
end
else
EMT.UNL = true
end
elseif Cmd[1] == '1' then
if Cmd[2] ~= 'Z' then
EMT.MCIND = EMT.MCIND + 1
if Cmd[2] == 'X1' then
EMT.MCX1[EMT.MCIND] = tonumber( Cmd[3])
EMT.MCX2[EMT.MCIND] = 0
elseif Cmd[2] == 'X2' then
EMT.MCX1[EMT.MCIND] = 0
EMT.MCX2[EMT.MCIND] = tonumber( Cmd[3])
end
end
elseif Cmd[1] == '2' then
EMT.MCIND = EMT.MCIND + 1
for i = 2, 4, 2 do
if Cmd[i] == 'X1' then
EMT.MCX1[EMT.MCIND] = tonumber( Cmd[i+1])
elseif Cmd[i] == 'X2' then
EMT.MCX2[EMT.MCIND] = tonumber( Cmd[i+1])
end
end
if not EMT.MCX1[EMT.MCIND] then EMT.MCX1[EMT.MCIND] = 0 end
if not EMT.MCX2[EMT.MCIND] then EMT.MCX2[EMT.MCIND] = 0 end
elseif Cmd[1] == '3' then
EMT.MCIND = EMT.MCIND + 1
for i = 2, 6, 2 do
if Cmd[i] == 'X1' then
EMT.MCX1[EMT.MCIND] = tonumber( Cmd[i+1])
elseif Cmd[i] == 'X2' then
EMT.MCX2[EMT.MCIND] = tonumber( Cmd[i+1])
end
end
elseif Cmd[1] == '11' then
EMT.X1STAT = tonumber( Cmd[2])
if Cmd[2] == 0 then
EMT.X1CLAMP = nil
else
EMT.X1CLAMP = true
end
elseif Cmd[1] == '12' then
if Cmd[2] == 0 then
EMT.X2CLAMP = nil
else
EMT.X2CLAMP = true
end
EMT.X2STAT = tonumber( Cmd[2])
if EMT.UNL and EMT.X2STAT == 0 then
-- local sWait = 'WAIT_CHAN(2)'
-- table.insert( EMT.AUXSTR, sWait)
local sSync = 'STOPRE'
table.insert( EMT.AUXSTR, sSync)
local nFunz = 6
local nVertClamp = 0
local dPress = 2.5
local dFeed = GetClampFeed( EMT.LENGTHPART)
local dAcc = 4
local nOpt = 0
local sRef1 = EMT.MCX2[#EMT.MCX2]
local sRef2 = EmtLenToString( ParkX2 - ( EMT.LENGTHBEAM - EMT.X2DELTA), 3)
local sOut = string.format( '_POSIZ_T(%d,%d,%.1f,%.1f,%.1f,%d,%s,%s,,)', nFunz, nVertClamp, dPress, dFeed, dAcc, nOpt, sRef1, sRef2)
elseif Cmd[1] == '2' then
EMT.NSTEP = EMT.NSTEP + 10
local sStep = EgtNumToString( EMT.NSTEP, 0)
local sOut = '_STEP='..sStep
table.insert( EMT.AUXSTR, sOut)
end
elseif Cmd[1] == '21' then
local dX1Delta = tonumber( Cmd[2])
local dX2Delta = tonumber( Cmd[3])
if dX1Delta > 0 and dX2Delta > 0 then
EMT.X1DELTA = dX1Delta
EMT.X2DELTA = dX2Delta
elseif dX1Delta > 0 then
EMT.X1DELTA = dX1Delta
EMT.X2DELTA = nil
elseif dX2Delta > 0 then
EMT.X1DELTA = nil
EMT.X2DELTA = dX2Delta
end
if EMT.AUXIND > 1 then
local sInfo = string.format( ';X1->X2 D2=%.1f', EMT.LENGTHBEAM - EMT.X2DELTA)
table.insert( EMT.AUXSTR, sInfo)
local sWait = 'WAIT_CHAN(2)'
table.insert( EMT.AUXSTR, sWait)
local sSync = 'STOPRE'
table.insert( EMT.AUXSTR, sSync)
local nFunz = 31
local nVertClamp = 0
local dPress = 2.5
local dFeed = GetClampFeed( EMT.LENGTHBEAM)
local dAcc = 4
local nOpt = EgtIf( EMT.MCIND >= 3, 2, 1)
local sRef1 = EmtLenToString( EMT.MCX1[1], 3)
local sRef2 = EmtLenToString( EMT.MCX2[1], 3)
local sRef3 = EmtLenToString( EMT.MCX1[2], 3)
local sRef4 = EmtLenToString( EgtIf( EMT.MCX2[2] == 0, EMT.MCX2[1], EMT.MCX2[2]), 3)
local sOut = string.format( '_POSIZ_T(%d,%d,%.1f,%.1f,%.1f,%d,%s,%s,%s,%s)', nFunz, nVertClamp, dPress, dFeed, dAcc, nOpt, sRef1, sRef2, sRef3, sRef4)
local sX2Pos = Cmd[5]
sOut = string.format( 'G1 X=%s F=%d', sX2Pos, EMT.FMAXPINZE)
table.insert( EMT.AUXSTR, sOut)
sOut = '_N'..sStep..':STOPRE\n'
table.insert( EMT.AUXSTR, sOut)
elseif Cmd[1] == '3' then
-- non gestito
elseif Cmd[1] == '11' then
-- non gestito
elseif Cmd[1] == '12' then
EMT.NSTEP = EMT.NSTEP + 10
local sStep = EgtNumToString( EMT.NSTEP, 0)
local sOut = '_STEP='..sStep
table.insert( EMT.AUXSTR, sOut)
sOut = '_POSIZ_T(5,,,,,1,,,,)' -- apre pinza 2 restando su processo 1
table.insert( EMT.AUXSTR, sOut)
sOut = '_N'..sStep..':STOPRE\n'
table.insert( EMT.AUXSTR, sOut)
elseif Cmd[1] == '21' then
-- non interessa
end
else
if Cmd[1] == '0' then
-- se è scarico
if Cmd[2] == 'Unloading' then
EMT.UNL = true
-- Lancio macro per carico anticipato: i valori sono presi dal plc (passati dall'interfaccia)
local sOut = '_POSIZ_T(4,,,,,,,,,)'
table.insert( EMT.AUXSTR, sOut)
end
elseif Cmd[1] == '1' then
if Cmd[2] ~= 'Z' then
local dFeed1 = EgtIf( EMT.X1CLAMP, GetClampFeed( EMT.LENGTHPART), EMT.FMAXPINZE)
local dFeed2 = EgtIf( EMT.X2CLAMP, GetClampFeed( EMT.LENGTHPART), EMT.FMAXPINZE)
local dX1Pos = GetValInString( sCmd, 'X1')
local dX2Pos = GetValInString( sCmd, 'X2')
table.insert( CLAMP_POS, '###_ADD_STEP_###')
if dX1Pos and dX2Pos then
table.insert( CLAMP_POS, string.format( 'POS[X1]=%.3f POS[X2]=%.3f FA[X1]=%d FA[X2]=%d', dX1Pos, dX2Pos, dFeed1, dFeed2))
elseif dX1Pos then
table.insert( CLAMP_POS, string.format( 'G1 X1=%.3f F=%d', dX1Pos, dFeed1))
elseif dX2Pos then
table.insert( CLAMP_POS, string.format( 'G1 X2=%.3f F=%d', dX2Pos, dFeed2))
end
end
elseif Cmd[1] == '2' then
local dFeed1 = EgtIf( EMT.X1CLAMP, GetClampFeed( EMT.LENGTHPART), EMT.FMAXPINZE)
local dFeed2 = EgtIf( EMT.X2CLAMP, GetClampFeed( EMT.LENGTHPART), EMT.FMAXPINZE)
local dX1Pos = GetValInString( sCmd, 'X1')
local dX2Pos = GetValInString( sCmd, 'X2')
table.insert( CLAMP_POS, '###_ADD_STEP_###')
if dX1Pos and dX2Pos then
table.insert( CLAMP_POS, string.format( 'POS[X1]=%.3f POS[X2]=%.3f FA[X1]=%d FA[X2]=%d', dX1Pos, dX2Pos, dFeed1, dFeed2))
elseif dX1Pos then
table.insert( CLAMP_POS, string.format( 'G1 X1=%.3f F=%d', dX1Pos, dFeed1))
elseif dX2Pos then
table.insert( CLAMP_POS, string.format( 'G1 X2=%.3f F=%d', dX2Pos, dFeed2))
end
elseif Cmd[1] == '3' then
local dFeed1 = EgtIf( EMT.X1CLAMP, GetClampFeed( EMT.LENGTHPART), EMT.FMAXPINZE)
local dFeed2 = EgtIf( EMT.X2CLAMP, GetClampFeed( EMT.LENGTHPART), EMT.FMAXPINZE)
local dX1Pos = GetValInString( sCmd, 'X1')
local dX2Pos = GetValInString( sCmd, 'X2')
table.insert( CLAMP_POS, '###_ADD_STEP_###')
table.insert( CLAMP_POS, string.format( 'POS[X1]=%.3f POS[X2]=%.3f FA[X1]=%d FA[X2]=%d', dX1Pos, dX2Pos, dFeed1, dFeed2))
elseif Cmd[1] == '11' then
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
EMT.X1CLAMP = true
local sVertClamp = EgtIf( Cmd[2] == '2', '1', '0')
table.insert( CLAMP_POS, 'GRIPPER("CH1",'.. sVertClamp ..',2.5)')
end
elseif Cmd[1] == '12' then
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
EMT.X2CLAMP = true
local sVertClamp = EgtIf( Cmd[2] == '2', '1', '0')
table.insert( CLAMP_POS, 'GRIPPER("CH2",'.. sVertClamp ..',2.5)')
end
elseif Cmd[1] == '21' then
local dX1Delta = tonumber( Cmd[2])
local dX2Delta = tonumber( Cmd[3])
if dX1Delta > 0 and dX2Delta > 0 then
EMT.X1DELTA = dX1Delta
EMT.X2DELTA = dX2Delta
elseif dX1Delta > 0 then
EMT.X1DELTA = dX1Delta
EMT.X2DELTA = nil
elseif dX2Delta > 0 then
EMT.X1DELTA = nil
EMT.X2DELTA = dX2Delta
end
-- se ci sono movimenti, si scrive macro
if #CLAMP_POS > 0 then
table.insert( ALL_CLAMP_POS, CLAMP_POS)
CLAMP_POS = {}
EMT.NSTEP = EMT.NSTEP + 10
local sStep = EgtNumToString( EMT.NSTEP, 0)
table.insert( EMT.AUXSTR, '_STEP='..sStep)
local nFunz = 77
local nVertClamp = 0
local dPress = 2.5
local dFeed = GetClampFeed( EMT.LENGTHPART)
local dAcc = 4
local nOpt = #ALL_CLAMP_POS * 100
local sOut = string.format( '_POSIZ_T(%d,,,,,%d,,,,,,)', nFunz, nOpt)
table.insert( EMT.AUXSTR, sOut)
sOut = '_N'..sStep..':STOPRE\n'
table.insert( EMT.AUXSTR, sOut)
end
end
end
end
@@ -1300,12 +1342,28 @@ function PrepareUnload( sCmd)
local sStep = EgtNumToString( EMT.NSTEP, 0)
local sOut = '_STEP='..sStep
table.insert( EMT.AUXSTR, sOut)
sOut = '_N'..sStep..':STOPRE'
table.insert( EMT.AUXSTR, sOut)
local sX2Pos = Cmd[3]
sOut = string.format( 'G1 X=%s F=%d', sX2Pos, EMT.FMAXPINZE)
sOut = string.format( 'POS[X2]=%s FA[X2]=%d', sX2Pos, EMT.FMAXPINZE)
table.insert( EMT.AUXSTR, sOut)
sOut = '_POSIZ_T(5,,,,,2,,,,)' -- attiva spintore scarico pezzo restanto su processo 1
sOut = '_POSIZ_T(5,,,,,3,,,,)\n' -- discesa blocco pezzo
table.insert( EMT.AUXSTR, sOut)
sOut = '_N'..sStep..':STOPRE\n'
EMT.NSTEP = EMT.NSTEP + 10
sStep = EgtNumToString( EMT.NSTEP, 0)
sOut = '_STEP='..sStep
table.insert( EMT.AUXSTR, sOut)
sOut = '_N'..sStep..':STOPRE'
table.insert( EMT.AUXSTR, sOut)
sOut = '_POSIZ_T(5,,,,,4,,,,)\n' -- pistone scarico avanti per spingere pezzo
table.insert( EMT.AUXSTR, sOut)
EMT.NSTEP = EMT.NSTEP + 10
sStep = EgtNumToString( EMT.NSTEP, 0)
sOut = '_STEP='..sStep
table.insert( EMT.AUXSTR, sOut)
sOut = '_N'..sStep..':STOPRE'
table.insert( EMT.AUXSTR, sOut)
sOut = '_POSIZ_T(5,,,,,5,,,,)\n' -- pistone scarico indietro
table.insert( EMT.AUXSTR, sOut)
end
elseif Cmd[1] == '2' then
@@ -1313,10 +1371,10 @@ function PrepareUnload( sCmd)
local sStep = EgtNumToString( EMT.NSTEP, 0)
local sOut = '_STEP='..sStep
table.insert( EMT.AUXSTR, sOut)
local sX2Pos = Cmd[5]
sOut = string.format( 'G1 X=%s F=%d', sX2Pos, EMT.FMAXPINZE)
sOut = '_N'..sStep..':STOPRE'
table.insert( EMT.AUXSTR, sOut)
sOut = '_N'..sStep..':STOPRE\n'
local sX2Pos = Cmd[5]
sOut = string.format( 'POS[X2]=%s FA[X2]=%d\n', sX2Pos, EMT.FMAXPINZE)
table.insert( EMT.AUXSTR, sOut)
elseif Cmd[1] == '3' then
-- non gestito
@@ -1327,9 +1385,17 @@ function PrepareUnload( sCmd)
local sStep = EgtNumToString( EMT.NSTEP, 0)
local sOut = '_STEP='..sStep
table.insert( EMT.AUXSTR, sOut)
sOut = '_POSIZ_T(5,,,,,1,,,,)' -- apre pinza 2 restando su processo 1
sOut = '_N'..sStep..':STOPRE'
table.insert( EMT.AUXSTR, sOut)
sOut = '_N'..sStep..':STOPRE\n'
sOut = '_POSIZ_T(5,,,,,1,,,,)\n' -- apre pinza 2
table.insert( EMT.AUXSTR, sOut)
EMT.NSTEP = EMT.NSTEP + 10
sStep = EgtNumToString( EMT.NSTEP, 0)
sOut = '_STEP='..sStep
table.insert( EMT.AUXSTR, sOut)
sOut = '_N'..sStep..':STOPRE'
table.insert( EMT.AUXSTR, sOut)
sOut = '_POSIZ_T(5,,,,,2,,,,)\n' -- solleva il blocca-pezzo
table.insert( EMT.AUXSTR, sOut)
elseif Cmd[1] == '21' then
-- non interessa
@@ -1648,13 +1714,13 @@ function CalcInterpPlane()
local dAngO2 = EmtGetAngO2( EMT.IPLGLFR:getVersZ(), EMT.IPLGLFR:getVersX(), dAngV, dAngO)
local sXout, sYout, sZout
if EMT.X1DELTA then
sXout = ' X='..EmtLenToString( xS + EMT.X1DELTA)..'+OFS_T5_X1[0]'
sYout = ' Y=OFS_T5_X1[1]'
sZout = ' Z=OFS_T5_X1[2]'
sXout = ' X='..EmtLenToString( xS + EMT.X1DELTA)..'+OFS_TS1_X1[0]'
sYout = ' Y=OFS_TS1_X1[1]'
sZout = ' Z=OFS_TS1_X1[2]'
elseif EMT.X2DELTA then
sXout = ' X='..EmtLenToString( xS + EMT.X2DELTA)..'+OFS_T5_X2[0]'
sYout = ' Y=OFS_T5_X2[1]'
sZout = ' Z=OFS_T5_X2[2]'
sXout = ' X='..EmtLenToString( xS + EMT.X2DELTA)..'+OFS_TS1_X2[0]'
sYout = ' Y=OFS_TS1_X2[1]'
sZout = ' Z=OFS_TS1_X2[2]'
else
EmtSetLastError( 1214, "Part to machine without charriots")
end
@@ -1734,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
+4 -2
View File
@@ -9,7 +9,7 @@
require( 'EmtGenerator')
EgtEnableDebug( false)
PP_VER = '3.1d1_DEV7'
PP_VER = '3.1e1_DEV4'
MIN_MACH_VER = '3.1c1'
EgtOutLog ( '** Saomad-KAIROS '..PP_VER..' (MinMach '.. MIN_MACH_VER ..') **', 1)
@@ -19,7 +19,7 @@ NumericalControl = 'SIEMENS'
ChainSaw = false
MinY = -823
MaxY = 520
ParkY = 400
ParkY = -125
FmaxY = 45000
MinZ = -298
MaxZ = 915
@@ -30,6 +30,8 @@ MaxA = 120
MinSawA = -101
MaxSawA = 101
ParkA = 0
TakePosTC_R = -90
TakePosTC_L = 90
FmaxA = 10440
MinC = -240
MaxC = 240
+24 -8
View File
@@ -504,6 +504,10 @@ function OnSimulToolSelect( dPosCS)
EMT.TCPOS_1 = EMT.TCPOS
-- lo nascondo sul portautensili
ShowToolInTcPos( EMT.TCPOS, false)
-- movimento di uscita dal porta utensile
if EMT.HEAD == 'H1' or EMT.HEAD == 'H2' then
SimulMoveAxes( 'Y', ParkY, MCH_SIM_STEP.RAPID, 'A', ParkA, MCH_SIM_STEP.RAPROT, 'C', ParkC, MCH_SIM_STEP.RAPROT)
end
end
---------------------------------------------------------------------
@@ -522,30 +526,39 @@ function OnSimulToolDeselect()
else
SimulMoveAxes( 'A', ParkA, MCH_SIM_STEP.COLLROT, 'C', GetChainSawCHomeFromVirtualAxis( dPosCS), MCH_SIM_STEP.COLLROT)
end
SimulMoveAxis( 'Y', ParkY, MCH_SIM_STEP.RAPID)
elseif EMT.HEAD == 'H2' then
SimulMoveAxes( 'A', TakePosTC_R, MCH_SIM_STEP.COLLROT, 'C', ParkC, MCH_SIM_STEP.COLLROT)
elseif EMT.HEAD == 'H1' then
SimulMoveAxes( 'A', TakePosTC_L, MCH_SIM_STEP.COLLROT, 'C', ParkC, MCH_SIM_STEP.COLLROT)
end
SimulMoveAxis( 'Y', MinY, MCH_SIM_STEP.RAPID)
-- breve pausa
EgtPause( 100)
-- nascondo utensile su testa e lo visualizzo su TcPos
EgtSetMode( EgtGetHeadId( EMT.HEAD), GDB_MD.HIDDEN)
ShowToolInTcPos( EMT.TCPOS_1, true)
-- movimento per carico utensile
SimulMoveAxes( 'A', ParkA, MCH_SIM_STEP.RAPROT, 'C', ParkC, MCH_SIM_STEP.RAPROT)
--SimulMoveAxes( 'Y', ParkY, MCH_SIM_STEP.RAPID, 'A', ParkA, MCH_SIM_STEP.RAPROT, 'C', ParkC, MCH_SIM_STEP.RAPROT)
EgtOutText( '')
-- deposito utensile
else
if EMT.NEXTTOOL ~= EMT.TOOL_1 then
EgtOutText( 'Tool change in progress...')
-- simulo movimento
SimulMoveAxes( 'A', ParkA, MCH_SIM_STEP.COLLROT, 'C', ParkC, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'Y', ParkY, MCH_SIM_STEP.RAPID)
if EMT.HEAD == 'H2' then
SimulMoveAxes( 'A', TakePosTC_R, MCH_SIM_STEP.COLLROT, 'C', ParkC, MCH_SIM_STEP.COLLROT)
elseif EMT.HEAD == 'H1' then
SimulMoveAxes( 'A', TakePosTC_L, MCH_SIM_STEP.COLLROT, 'C', ParkC, MCH_SIM_STEP.COLLROT)
end
SimulMoveAxis( 'Y', MinY, MCH_SIM_STEP.RAPID)
-- breve pausa
EgtPause( 100)
-- nascondo utensile su testa e lo visualizzo su TcPos
EgtSetMode( EgtGetHeadId( EMT.HEAD), GDB_MD.HIDDEN)
ShowToolInTcPos( EMT.TCPOS_1, true)
-- nascondo l'utensile corrente
EgtSetStatus( EgtGetHeadId( EMT.HEAD), GDB_ST.OFF)
-- eseguo movimento opportuno
SimulMoveAxes( 'A', ParkA, MCH_SIM_STEP.RAPROT, 'C', ParkC, MCH_SIM_STEP.RAPROT)
EgtOutText( '')
-- eseguo movimento opportuno
--SimulMoveAxes( 'A', ParkA, MCH_SIM_STEP.RAPROT, 'C', ParkC, MCH_SIM_STEP.RAPROT)
else
EMT.TOOL_1 = nil
EMT.TCPOS_1 = nil
@@ -1665,8 +1678,11 @@ function IsLastMachining( nMchId)
local nOpeId = EgtGetNextActiveOperation( nMchId)
while nOpeId do
local nType = EgtGetOperationType( nOpeId)
-- se c'è una lavorazione
if nType ~= MCH_OY.NONE and nType ~= MCH_OY.DISP then
return false
elseif nType == MCH_OY.DISP and IsRestPhase( EMT.PHASE + 1) then
return false
end
nOpeId = EgtGetNextActiveOperation( nOpeId)
end