PF1250 : - Gestione lavorazione in doppio da PF1250rl

- Gestione seconda lama da PF1250rl
              - Piccole modifiche per allineamento a PF1250rl
This commit is contained in:
andrea.villa
2023-11-21 13:05:14 +01:00
parent d09943365a
commit e317e20d93
6 changed files with 738 additions and 251 deletions
+264 -35
View File
@@ -1,4 +1,4 @@
-- Processore macchina Essetre-PF1250 by EgalTech s.r.l. 2023/06/06
-- Processore macchina Essetre-PF1250 by EgalTech s.r.l. 2023/11/21
-- Con controllo numerico TPA
-- Carico i dati globali
@@ -105,7 +105,12 @@ end
function OnToolData()
-- emissione dati utensile (esclusa sega a catena)
if EMT.HEAD ~= 'H13' then
local dAddLen = EgtIf( EMT.HEAD == 'H12', -SawOffsZ, 0)
local dAddLen = 0
if EMT.HEAD == 'H12' then
dAddLen = -SawOffsZ
elseif EMT.HEAD == 'H16' then
dAddLen = -Saw2OffsZ
end
local sOut = 'M992 P1=' .. EMT.TCPOS:gsub( 'T', '') .. ' P2=' .. EmtLenToString( dAddLen + EMT.TLEN, 3) .. ' P3=' .. EmtLenToString( EMT.TDIAM, 3) ..
' P4=' .. EmtLenToString( EMT.SMAX, 3) .. ' P5=' .. EmtLenToString( dAddLen + EMT.TTOTLEN, 3)
MyOutput( sOut)
@@ -245,10 +250,12 @@ function OnDispositionEnd()
else
if #EMT.MDCHAR > 0 then
EmitRemark( 'PART UNLOAD')
end
for i = 1, #EMT.MDCHAR do
EmitMoveDataChars( EMT.MDCHAR[i])
if EMT.MDCHAR[i].Y1 then EMT.CHY_ON = true end
end
if #EMT.MDCHAR > 0 then
local nMoveType = EgtIf( EMT.CHY_ON, 3, 2)
EmitMoveStartChars( nMoveType)
-- se dopo c'è scarico spezzone devo mettere attesa termine esecuzione
@@ -364,18 +371,40 @@ function OnMachiningStart()
local MyParkCSawC1 = GetChainSawCHomeFromVirtualAxis( dPosA)
EmtModifyAxisHome( 'C1', MyParkCSawC1)
end
-- gestione eventuale lavorazione in doppio
local nDouType = EgtGetValInNotes( EMT.MCHUSERNOTES, 'DOUBLE', 'i')
if nDouType == 2 or nDouType == 3 then
local sDouTool = EgtGetValInNotes( EMT.TUSERNOTES, 'DOUBLE', 's') or ''
local sOldTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
if EgtTdbSetCurrTool( sDouTool) and EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) then
-- salvo dati
EMT.DOU_TLEN = EgtTdbGetCurrToolParam( MCH_TP.LEN)
EMT.DOU_TYPE = nDouType
EMT.DOU_TOOL = sDouTool
EMT.DOU_HEAD = 'H21'
EMT.DOU_EXIT = 1
EMT.DOU_TPOS = AdjustTcPos( false, EgtTdbGetCurrToolParam( MCH_TP.TCPOS))
EMT.DOU_SPEED = EgtTdbGetCurrToolParam( MCH_TP.SPEED)
-- non va in sicurezza testa in doppio
EMT.DOU_TO_ZMAX = nil
else
EmtSetLastError( 1211, 'Missing or not active double tool of '..sOldTool)
end
EgtTdbSetCurrTool( sOldTool)
end
-- se testa in doppio ancora da rimettere in sicurezza
if EMT.DOU_TO_ZMAX then
local dPosT = EMT.TPOS or EMT.L1op
EmitParkRoller( dPosT, false)
EmitDouZMax( EMT.DOU_TO_ZMAX)
end
end
---------------------------------------------------------------------
function OnMachiningEnd()
--MyOutput( ';Mach End')
-- Se Cut, aggiorno lunghezza
if EMT.MCHUSERNOTES:find( 'Cut', 1, true) then
EMT.LB = EMT.LT
end
-- Se ci sono movimenti carrelli da emettere (con Split e Split2 aggiorno lunghezza)
-- Emissione split
if #EMT.MDCHAR > 0 then
-- Intestazioni
if EMT.AUXTYPE == 'S' then
EmitRemark( 'PART SPLIT')
EMT.LB = EMT.LT
@@ -397,14 +426,13 @@ function OnMachiningEnd()
EmitZmax( false, true, EMT.R1, EMT.R2)
EMT.ZMAX = true
EmitRemark( 'PART SPLIT 2')
EMT.LB = EMT.LT
end
end
-- Emissione movimenti carrelli
end
for i = 1, #EMT.MDCHAR do
EmitMoveDataChars( EMT.MDCHAR[i])
end
-- Completamento
if #EMT.MDCHAR > 0 then
if EMT.AUXTYPE == 'S' then
EmitMoveStartChars( 1)
EmitMoveWaitChars( 1)
@@ -442,6 +470,8 @@ function OnMachiningEnd()
EMT.AUXTYPE = nil
EMT.TO_ZMAX = nil
EMT.PREVTOOL = EMT.TOOL
if EMT.DOU_TYPE and not EMT.ZMAX then EMT.DOU_TO_ZMAX = EMT.DOU_TYPE end
EMT.DOU_TYPE = nil
end
---------------------------------------------------------------------
@@ -582,15 +612,17 @@ function OnRapid()
if EMT.LOAD then
EMT.V2POS = ParkV2
-- primo posizionamento
local Speed = EMT.S * EgtIf( EMT.HEAD ~= 'H12', 1, 1.65)
local Speed = EMT.S
if EMT.HEAD == 'H12' or EMT.HEAD == 'H16' then Speed = 1.65 * EMT.S end
local bOnlyCharY = true
for i = 1, #EMT.AUXCMD do
ProcessPathStartAux( EMT.AUXCMD[i], i)
end
EMT.AUXCMD = {}
-- se Split e non misura laser lascio agganciata solo la pinza Y2 alla fine dei movimenti
-- se Split e non Caduta lascio agganciata solo la pinza Y2 alla fine dei movimenti
local bSplitCut = ( EMT.MCHUSERNOTES:find( 'Split', 1, true) ~= nil)
if bSplitCut and #EMT.MDCHAR > 0 and EMT.MDCHAR[#EMT.MDCHAR].IniStatY1 ~= -76 then
local bFall = ( bSplitCut and FindFallAtEndAux( EMT.PATHID))
if ( bSplitCut and not bFall and #EMT.MDCHAR > 0) then
EMT.MDCHAR[#EMT.MDCHAR].FinStatY1 = 1
end
for i = 1, #EMT.MDCHAR do
@@ -604,7 +636,8 @@ function OnRapid()
if nHSet == 1 then
-- selezione testa (posso muovere X solo a Zmax)
local MaxZ1 = EgtGetAxisMax( 'Z1')
EmitMoveDataHead( 1, { X=EMT.L2, Z=MaxZ1, S=Speed})
local bXSpec = ( EMT.L2 < -DeltaTabY)
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), Z=MaxZ1, S=Speed})
EmitMoveStartHead( 1)
EmitMoveWaitHead( 1)
EmitMoveWaitChars( EgtIf( bOnlyCharY, 1, 3))
@@ -637,7 +670,6 @@ function OnRapid()
end
-- altrimenti sega a catena
else
local bXSpec = ( EMT.L2 < -DeltaTabY)
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), S=Speed})
EmitMoveDataHead( 1, { Z=dSafeZ1, S=Speed})
if bXSpec then
@@ -646,8 +678,33 @@ function OnRapid()
end
EmitMoveDataHead( 1, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
EmitMoveStartHead( 1)
-- se lavorazione in doppio
if EMT.DOU_TYPE == 2 then
local dX2 = Delta2TabY + EMT.DOU_TLEN - ( -DeltaTabY - EMT.L2 + EMT.TLEN - EMT.HB)
local dZ2 = -Head2Z + MillOffs + Mill2Offs + EMT.L3
dZ2 = min( dZ2, MaxZ2)
local dC2 = EMT.R1
local dB2 = EMT.R2
EmitMoveDataHead( 2, { X=dX2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
EmitMoveDataHead( 2, { Z=-dZ2, B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
EmitMoveStartHead( 2)
-- aspetto esecuzione movimento testa 2
EmitMoveWaitHead( 2)
elseif EMT.DOU_TYPE == 3 then
local dX2 = -Head2Y - EMT.L2
local dZ2 = Delta2TabZ - EMT.DOU_TLEN - ( -DeltaTabZ + EMT.L3 - EMT.TLEN - EMT.SB)
dZ2 = max( dZ2, MinZ2)
local dC2 = EMT.R1
local dB2 = EMT.R2
EmitMoveDataHead( 2, { X=dX2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
EmitMoveDataHead( 2, { Z=-dZ2, B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
EmitMoveStartHead( 2)
-- aspetto esecuzione movimento testa 2
EmitMoveWaitHead( 2)
else
-- eventuale preselezione successiva testa 2
PreselectNextDiffHead( EMT.MCHID, EMT.HEAD)
end
-- aspetto esecuzione movimento testa 1
EmitMoveWaitHead( 1)
-- altrimenti testa 2
@@ -720,6 +777,10 @@ function OnRapid()
local ProdId = EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'PRODID', 'i') or 0
MyOutput( ';LISTA = ' .. tostring( ProdId))
EmitParkedLines()
-- se sfrido grande, emetto comando speciale
if EMT.HOVM > 99 then
MyOutput( ';M107')
end
-- altrimenti lavorazione successiva
else
--MyOutput( string.format( 'V1Pos=%.3f V2Pos=%.3f', EMT.V1POS, EMT.V2POS))
@@ -731,14 +792,15 @@ function OnRapid()
PrevR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'B1', 'B2'))
end
EmitRemark( ' *** '..EMT.MCHNAME..'/'..EMT.TOOL..' *** ')
-- se Split lascio agganciata solo la pinza Y2 alla fine dei movimenti
local bSplitCut = ( EMT.MCHUSERNOTES:find( 'Split', 1, true) ~= nil)
-- eventuale movimento carrelli
for i = 1, #EMT.AUXCMD do
ProcessPathStartAux( EMT.AUXCMD[i], i)
end
EMT.AUXCMD = {}
if bSplitCut and #EMT.MDCHAR > 0 then
-- se Split e non Caduta lascio agganciata solo la pinza Y2 alla fine dei movimenti
local bSplitCut = ( EMT.MCHUSERNOTES:find( 'Split', 1, true) ~= nil)
local bFall = ( bSplitCut and FindFallAtEndAux( EMT.PATHID))
if ( bSplitCut and not bFall and #EMT.MDCHAR > 0) then
EMT.MDCHAR[#EMT.MDCHAR].FinStatY1 = 1
end
for i = 1, #EMT.MDCHAR do
@@ -760,37 +822,48 @@ function OnRapid()
local dPosT = EMT.TPOS or EMT.L1op
EmitParkRoller( dPosT, bSplitCut)
end
-- se taglio di coda senza residuo da scaricare, emetto M175 per accelerare il carico della barra successiva
-- se taglio di coda senza residuo da scaricare
if EMT.MCHUSERNOTES and EMT.MCHUSERNOTES:find( 'Cut', 1, true) then
-- se sfrido grande, emetto comando speciale
if EMT.LB - EMT.LT > 99 then
MyOutput( ';M107')
end
-- emetto M175 per accelerare il carico della barra successiva
MyOutput( ';M175')
end
-- se testa 1
if nHSet == 1 then
local dSafeZ1 = EgtGetAxisHomePos( 'Z1')
local Speed = EMT.S * EgtIf( EMT.HEAD ~= 'H12', 1, 1.65)
local Speed = EMT.S
if EMT.HEAD == 'H12' or EMT.HEAD == 'H16' then Speed = 1.65 * EMT.S end
if EMT.ZMAX or ( EMT.FLAG == 2 and EMT.FLAG2 == 1) then
-- se fresa o lama
if EMT.HEAD ~= 'H13' then
EmitMoveDataHead( 1, { X=EMT.L2, S=Speed})
-- muovo asse X
local bXSpec = ( EMT.L2 < -DeltaTabY)
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), S=Speed})
-- oriento
local Z_EXTRA = EgtIf( EMT.HEAD == 'H11', 250, 160)
local dZref
if EMT.R2 > -60 then
dZref = dSafeZ1+Z_EXTRA
dZref = min( dSafeZ1 + Z_EXTRA, MaxZ1)
EmitMoveDataHead( 1, { Z=dZref, B=min(EMT.R2,60), S=Speed})
if EMT.R2 > 60 then
dZref = dSafeZ1 + Z_EXTRA * ( 90 - abs( EMT.R2)) / 30
dZref = min( dSafeZ1 + Z_EXTRA * ( 90 - abs( EMT.R2)) / 30, MaxZ1)
EmitMoveDataHead( 1, { Z=dZref, B=min(EMT.R2,90), S=Speed})
end
else
dZref = dSafeZ1 + Z_EXTRA * ( 90 - abs( EMT.R2)) / 30
dZref = min( dSafeZ1 + Z_EXTRA * ( 90 - abs( EMT.R2)) / 30, MaxZ1)
EmitMoveDataHead( 1, { Z=dZref, B=EMT.R2, S=Speed})
end
if dZref and EMT.L3 < dZref + 0.1 then
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed})
if bXSpec and EMT.L3 < dZref - 0.1 then
EmitMoveDataHead( 1, { X=EMT.L2, S=Speed})
end
end
-- altrimenti sega a catena
else
local bXSpec = ( EMT.L2 < -DeltaTabY)
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), S=Speed})
EmitMoveDataHead( 1, { Z=dSafeZ1, S=Speed})
if bXSpec then
@@ -800,8 +873,41 @@ function OnRapid()
end
EmitMoveDataHead( 1, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
EmitMoveStartHead( 1)
-- se lavorazione in doppio
if EMT.DOU_TYPE == 2 then
local dC2 = EMT.R1
local dB2 = EMT.R2
if EMT.ZMAX or ( EMT.FLAG == 2 and EMT.FLAG2 == 1) then
local dSafeZ2 = EgtGetAxisHomePos( 'Z2')
EmitMoveDataHead( 2, { Z=-dSafeZ2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
EmitMoveDataHead( 2, { B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
else
local dX2 = Delta2TabY + EMT.DOU_TLEN - ( -DeltaTabY - EMT.L2 + EMT.TLEN - EMT.HB)
local dZ2 = EgtClamp( -Head2Z + MillOffs + Mill2Offs + EMT.L3, MinZ2, MaxZ2)
EmitMoveDataHead( 2, { X=dX2, Z=-dZ2, B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
end
EmitMoveStartHead( 2)
-- aspetto esecuzione movimento testa 2
EmitMoveWaitHead( 2)
elseif EMT.DOU_TYPE == 3 then
local dX2 = -Head2Y - EMT.L2
local dZ2 = Delta2TabZ - EMT.DOU_TLEN - ( -DeltaTabZ + EMT.L3 - EMT.TLEN - EMT.SB)
dZ2 = max( dZ2, MinZ2)
local dC2 = EMT.R1
local dB2 = EMT.R2
if EMT.ZMAX then
local dSafeZ2 = EgtGetAxisHomePos( 'Z2')
EmitMoveDataHead( 2, { Z=-dSafeZ2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
EmitMoveDataHead( 2, { X=dX2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
end
EmitMoveDataHead( 2, { X=dX2, Z=-dZ2, B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
EmitMoveStartHead( 2)
-- aspetto esecuzione movimento testa 2
EmitMoveWaitHead( 2)
else
-- eventuale preselezione successiva testa 2
PreselectNextDiffHead( EMT.MCHID, EMT.HEAD)
end
-- aspetto esecuzione movimento testa 1
EmitMoveWaitHead( 1)
-- altrimenti testa 2
@@ -864,6 +970,47 @@ function OnRapid()
elseif EMT.FLAG == 0 or EMT.FLAG == 1 or EMT.FLAG == 2 then
-- se necessario, impostazione riferimento locale
if EMT.REFLOC == 0 then
-- se lavorazione in doppio
if EMT.DOU_TYPE == 2 then
-- aggiusto assi
EMT.L2 = -EMT.L2
-- emetto movimenti in Zero macchina
local Speed = EMT.S
if EMT.HEAD == 'H12' or EMT.HEAD == 'H16' then Speed = 1.65 * EMT.S end
EmitMoveDataHead( 1, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
EmitMoveStartHead( 1)
local dX2 = Delta2TabY + EMT.DOU_TLEN - ( -DeltaTabY - EMT.L2 + EMT.TLEN - EMT.HB)
local dZ2 = -Head2Z + MillOffs + Mill2Offs + EMT.L3
local dC2 = EMT.R1
local dB2 = EMT.R2
EmitMoveDataHead( 2, { Z=-dZ2, B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
EmitMoveDataHead( 2, { X=dX2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
EmitMoveStartHead( 2)
-- aspetto esecuzione movimento testa 2 e 1
EmitMoveWaitHead( 2)
EmitMoveWaitHead( 1)
-- ripristino assi
EMT.L2 = -EMT.L2
elseif EMT.DOU_TYPE == 3 then
-- aggiusto assi
EMT.L2 = -EMT.L2
-- emetto movimenti in Zero macchina
local Speed = EMT.S
if EMT.HEAD == 'H12' or EMT.HEAD == 'H16' then Speed = 1.65 * EMT.S end
EmitMoveDataHead( 1, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
EmitMoveStartHead( 1)
local dX2 = -Head2Y - EMT.L2
local dZ2 = Delta2TabZ - EMT.DOU_TLEN - ( -DeltaTabZ + EMT.L3 - EMT.TLEN - EMT.SB)
local dC2 = EMT.R1
local dB2 = EMT.R2
EmitMoveDataHead( 2, { X=dX2, Z=-dZ2, B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
EmitMoveStartHead( 2)
-- aspetto esecuzione movimento testa 2 e 1
EmitMoveWaitHead( 2)
EmitMoveWaitHead( 1)
-- ripristino assi
EMT.L2 = -EMT.L2
end
-- calcolo per piano generico
CalcInterpPlane()
EMT.REFLOC = 1
@@ -873,7 +1020,7 @@ function OnRapid()
EMT.L1p = nil
EMT.L2p = nil
EMT.L3p = nil
MyOutput( 'M105 P1=' .. GetFaceCode() .. ' P2='..EgtIf( EMT.HEAD ~= 'H21', '1', '2')..' P3=0')
MyOutput( 'M105 P1='..GetFaceCode()..' P2='..EgtIf( EMT.HEAD ~= 'H21', '1', '2')..' P3='..EgtIf( EMT.DOU_TYPE, 2, 0))
MyOutput( 'M98')
sOut = 'M6 ' .. EgtIf( EMT.HEAD ~= 'H21', 'T101', 'T202') .. AdjustTcPos( true)
MyOutput( sOut)
@@ -937,7 +1084,7 @@ function OnLinear()
EMT.L1p = nil
EMT.L2p = nil
EMT.L3p = nil
MyOutput( 'M105 P1=' .. GetFaceCode() .. ' P2='..EgtIf( EMT.HEAD ~= 'H21', '1', '2')..' P3=0')
MyOutput( 'M105 P1=' .. GetFaceCode() .. ' P2='..EgtIf( EMT.HEAD ~= 'H21', '1', '2')..' P3='..EgtIf( EMT.DOU_TYPE, 2, 0))
MyOutput( 'M98')
local sPos = EMT.TCPOS:gsub( 'T', '')
if #sPos == 1 then
@@ -976,6 +1123,12 @@ function OnLinear()
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
-- se lavorazione in doppio e fondo foro, inverto movimento punta doppia
local bDouHoleBott = ( EMT.MCHTYPE == MCH_MY.DRILLING and ( EMT.DOU_TYPE == 2 or EMT.DOU_TYPE == 3) and EMT.FLAG == 101)
if bDouHoleBott then
MyOutput( "M106 P1=1")
end
-- valori degli assi
local sAxes = EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..
EmtGetAxis('R2')..EmtGetAxis('R1')
@@ -986,6 +1139,16 @@ function OnLinear()
MyOutput( "G1" .. sAxes .. sFeed)
end
-- se lavorazione in doppio e fondo foro, muovo punta 2 e poi ripristino movimento standard punta doppia
if bDouHoleBott then
if EMT.DOU_TYPE == 2 or EMT.DOU_TYPE == 3 then
local dZ = 2 * EMT.L3p - EMT.L3
MyOutput( "G1 Z" .. EgtNumToString( dZ, 3))
MyOutput( "G1 Z" .. EgtNumToString( EMT.L3p, 3))
end
MyOutput( "M106 P1=2")
end
-- aggiorno valori come precedenti
EMT.TPOS = EMT.L1o
EmtUpdatePrev()
@@ -1644,7 +1807,12 @@ function MyAdjustLinearAxes()
if EMT.REFLOC then
local vtE
if EMT.HEAD ~= 'H13' then
local dAddLen = EgtIf( EMT.HEAD == 'H12', -SawOffsZ, 0)
local dAddLen = 0
if EMT.HEAD == 'H12' then
dAddLen = -SawOffsZ
elseif EMT.HEAD == 'H16' then
dAddLen = -Saw2OffsZ
end
if EMT.HEAD ~= 'H21' then
local Len = EMT.TLEN + dAddLen + MillOffs
local LenRef = MillOffs
@@ -1772,6 +1940,7 @@ function EmitZmax( bReset, bEnd, PrevR1, PrevR2, bSplitCut)
if EMT.HEAD ~= 'H21' then
-- posizioni sicure
local dMaxZ1 = EgtGetAxisMax( 'Z1')
local dSafeX1 = EgtGetAxisHomePos( 'X1')
local dSafeZ1 = EgtGetAxisHomePos( 'Z1')
local dSafeB1 = EgtGetAxisHomePos( 'B1')
local dSafeC1 = EgtGetAxisHomePos( 'C1')
@@ -1784,13 +1953,23 @@ function EmitZmax( bReset, bEnd, PrevR1, PrevR2, bSplitCut)
if EMT.HEAD ~= 'H13' then
-- eseguo la salita a Z1max (oriento solo se assi rotanti non già a posto)
if abs( dSafeC1 - PrevR1) > 0.1 or abs( dSafeB1 - PrevR2) > 0.1 then
if EMT.TTOTLEN < LongTool then
local bSafeZ = false
local Z_EXTRA = EgtIf( EMT.HEAD == 'H11', 250, 160)
if abs( PrevR2) < 60 then
local dZref = dSafeZ1 + Z_EXTRA
local dZref = min( dSafeZ1 + Z_EXTRA, MaxZ1)
EmitMoveDataHead( 1, { Z=dZref, Fmt=1})
bSafeZ = true
elseif abs( PrevR2) < 90 then
local dZref = dSafeZ1 + Z_EXTRA * ( 90 - abs( PrevR2)) / 30
local dZref = min( dSafeZ1 + Z_EXTRA * ( 90 - abs( PrevR2)) / 30, MaxZ1)
EmitMoveDataHead( 1, { Z=dZref, Fmt=1})
bSafeZ = true
end
if EMT.L2o < DeltaTabY then
if not bSafeZ then
EmitMoveDataHead( 1, { Z=dSafeZ1, B=EgtIf( PrevR2 > 0, 90, -90), Fmt=1})
end
EmitMoveDataHead( 1, { X=-DeltaTabY, Fmt=1})
end
local ANG_LIM_DOWN = EgtIf( EMT.HEAD == 'H11', 0, -45)
local ANG_LIM_OPPO = 90
@@ -1799,15 +1978,25 @@ function EmitZmax( bReset, bEnd, PrevR1, PrevR2, bSplitCut)
EmitMoveDataHead( 1, { Z=dSafeZ1, B=ANG_LIM_OPPO, Fmt=1})
end
if PrevR2 > 60 then
EmitMoveDataHead( 1, { Z=dSafeZ1+Z_EXTRA, B=60, Fmt=1})
EmitMoveDataHead( 1, { Z=min( dSafeZ1+Z_EXTRA, MaxZ1), B=60, Fmt=1})
end
EmitMoveDataHead( 1, { Z=dSafeZ1+Z_EXTRA, B=ANG_LIM_DOWN, Fmt=1})
EmitMoveDataHead( 1, { Z=min( dSafeZ1+Z_EXTRA, MaxZ1), B=ANG_LIM_DOWN, Fmt=1})
end
EmitMoveDataHead( 1, { Z=dSafeZ1, B=dSafeB1, Fmt=1})
EmitMoveDataHead( 1, { C=dSafeC1, Fmt=1})
else
EmitMoveDataHead( 1, { Z=dSafeZ1, Fmt=1})
EmitMoveDataHead( 1, { C=dSafeC1, Fmt=1})
EmitMoveDataHead( 1, { B=dSafeB1, Fmt=1})
end
end
EmitMoveDataHead( 1, { Z=dMaxZ1, Fmt=1})
EmitMoveStartHead( 1)
-- se lavorazione in doppio
if EMT.DOU_TYPE == 2 or EMT.DOU_TYPE == 3 then
EmitDouZMax( EMT.DOU_TYPE)
end
-- attesa fine movimento testa 1
EmitMoveWaitHead( 1)
-- altrimenti sega a catena
else
@@ -1841,11 +2030,35 @@ function EmitZmax( bReset, bEnd, PrevR1, PrevR2, bSplitCut)
end
end
---------------------------------------------------------------------
function EmitDouZMax( nDouType)
-- posizioni sicure
local dSafeX2 = EgtGetAxisHomePos( 'X2')
local dSafeZ2 = EgtGetAxisHomePos( 'Z2')
local dSafeB2 = EgtGetAxisHomePos( 'B2')
local dSafeC2 = EgtGetAxisHomePos( 'C2')
-- se lavorazione in doppio in Y (prima mi allontano in Y)
if nDouType == 2 then
EmitMoveDataHead( 2, { X=dSafeX2, TPos=EMT.DOU_TPOS, Fmt=1})
EmitMoveDataHead( 2, { B=dSafeB2, C=dSafeC2, TPos=EMT.DOU_TPOS, Fmt=1})
EmitMoveDataHead( 2, { Z=-dSafeZ2, TPos=EMT.DOU_TPOS, Fmt=1})
-- altrimenti lavorazione in doppio in Z (prima scendo in Z)
else
EmitMoveDataHead( 2, { Z=-dSafeZ2, TPos=EMT.DOU_TPOS, Fmt=1})
EmitMoveDataHead( 2, { B=dSafeB2, C=dSafeC2, TPos=EMT.DOU_TPOS, Fmt=1})
EmitMoveDataHead( 2, { X=dSafeX2, TPos=EMT.DOU_TPOS, Fmt=1})
end
EmitMoveStartHead( 2)
EmitMoveWaitHead( 2)
-- dichiaro eseguito
EMT.DOU_TO_ZMAX = nil
end
---------------------------------------------------------------------
function EmitResetMachining()
MyOutput( 'G27')
local sP12 = ''
if EMT.TOOL ~= GetNextTool( EMT.MCHID) then sP12 = EgtIf( EMT.HEAD ~= 'H21', ' P1=0', ' P2=0') end
if EMT.TOOL ~= GetNextTool( EMT.MCHID) then sP12 = EgtIf( EMT.HEAD ~= 'H21', ' P1=0'..EgtIf( EMT.DOU_TYPE, ' P2=0', ''), ' P2=0') end
local sP4 = EgtIf( EMT.MCHUSERNOTES:find( 'Split', 1, true), ' P4=1', '')
MyOutput( 'M99'..sP12..sP4)
end
@@ -1987,7 +2200,7 @@ function PreselectNextDiffHead( nMchId, sHead)
if sNextHead == 'H11' then
EmitMoveDataHead( 1, { X=dNextX, B=ParkB1, C=ParkC1, TPos=AdjustTcPos( false, sNextTcPos), Fmt=2})
EmitMoveStartHead( 1)
elseif sNextHead == 'H12' then
elseif sNextHead == 'H12' or sNextHead == 'H16' then
EmitMoveDataHead( 1, { X=dNextX, B=ParkB1, C=ParkC1, TPos=AdjustTcPos( false, sNextTcPos), Fmt=2})
EmitMoveStartHead( 1)
elseif sNextHead == 'H13' then
@@ -2025,6 +2238,22 @@ function FindReadHeadWithLaser( vMDChar)
return false
end
---------------------------------------------------------------------
function FindFallAtEndAux( nPathId)
for nInd = 1, 100 do
local sInfo = EgtGetInfo( nPathId, 'AE'..tostring( nInd))
if sInfo then
local Cmd = EgtSplitString( sInfo)
if ( Cmd[1] == '0' and Cmd[2] == 'Fall') then
return true
end
else
return false
end
end
return false
end
---------------------------------------------------------------------
function EmitRemark( sOut)
sOut = string.gsub( string.gsub( sOut, '%(', '['), '%)', ']')
+5 -1
View File
@@ -20,9 +20,11 @@ H11.1=Standard.nge
H11.1:MILL_NOTIP=MillNoTip.nge
H12.1=Saw.nge
H13.1=ChainSaw.nge
H16.1=Saw.nge
H21.1=Standard.nge
H21.1:MILL_NOTIP=MillNoTip.nge
H21.1:SAW_FLAT=SawH2.nge
H21.1:SAW_STD=SawH2Std.nge
H21.1:SAW_FLAT=SawH2Flat.nge
[Machinings]
Drilling=1
@@ -46,6 +48,8 @@ ExitScript=ExitMach.lua
H11=6608
; 5 axis saw
H12=6615
; Second 5 axis saw
H16=6623
; Chainsaw
H13=6616
; Second 5 axis head
+72 -7
View File
@@ -1,4 +1,4 @@
-- Descrizione macchina Essetre-PF1250 by EgalTech s.r.l. 2023/10/29
-- Descrizione macchina Essetre-PF1250 by EgalTech s.r.l. 2023/11/21
-- 2021/08/03 ver 2.3h1 Prima versione.
-- 2021/09/14 ver 2.3i9 Estesa gestione sega a catena.
-- 2021/09/15 ver 2.3i10 Correzione gestione posizione rimanenza.
@@ -28,12 +28,17 @@
-- 2023/09/29 ver 2.5i1 In BeamData e mlde aggiunta la lettura di alcuni parametri da Ts3Data.
-- 2023/10/12 ver 2.5j1 Sistemazioni per testa sotto più bassa quando in home.
-- 2023/10/29 ver 2.5j2 Correzione per calcolo se V1 e V2 vanno lasciati aperti e quindi in parcheggio (GetVnToCloseTPA).
-- 2023/11/21 ver 2.5k1 Gestione lavorazione in doppio da PF1250rl
-- Gestione seconda lama da PF1250rl
-- Piccole modifiche per allineamento a PF1250rl
-- Intestazioni
require( 'EmtGenerator')
EgtEnableDebug( false)
PP_VER = '2.5j2'
PP_VER = '2.5k1'
MIN_MACH_VER = '2.5k1'
-- Parametri macchina
NumericalControl = 'TPA' -- NUM o TPA
@@ -70,6 +75,11 @@ SawOffsY = 0
SawOffsZ = -150.25
SawC1Offs = 0
SawB1Offs = 0
Saw2OffsX = -111.0
Saw2OffsY = 0
Saw2OffsZ = -150.25
Saw2C1Offs = 0
Saw2B1Offs = 0
ChSawLen = 91.0
Mill2Offs = 170.0
SawC2Offs = 0
@@ -95,6 +105,9 @@ ParkCSaw0Z1 = -400
ParkCSawC1 = -90
ParkCSaw0C1 = 0
ParkCSawB1 = 0
LongTool = 400
ParkLongTc1C1 = 0
ParkLongTc2C1 = -180
MinZ1ToChangeH2 = -1400
MinX2 = -2760
MaxX2 = 0
@@ -108,6 +121,7 @@ ParkX2 = -100
ParkZ2 = 0
ParkC2 = -90
ParkB2 = -90
MinDistToolX1X2 = 40
TurnerOffs = 120.0
AggLoad = 50
DeltaTabY = 2467.0
@@ -124,6 +138,7 @@ DefTcPos1 = 'T1'
DefTcPos2 = 'T30'
CoeffVM = 0.5
Tc2Active = true
SecondSaw = true
-- Aggiornamento con dati da TechnoEssetre7
local sTs3Data = EgtGetStringFromIni( 'Beam', 'DATA_DIR', "C:\\TechnoEssetre7\\EgtData", EgtGetIniFile()).."\\Essetre-PF1250.data"
@@ -179,15 +194,18 @@ if EgtExistsFile( sDataBeam) then
if Machine.Offsets.PIVOT_T2 then Mill2Offs = Machine.Offsets.PIVOT_T2 end
if Machine.Offsets.OFFSETCLAMAT1 then SawC1Offs= Machine.Offsets.OFFSETCLAMAT1 end
if Machine.Offsets.OFFSETBLAMAT1 then SawB1Offs= Machine.Offsets.OFFSETBLAMAT1 end
if Machine.Offsets.OFFSETCLAMAT2 then SawC2Offs= Machine.Offsets.OFFSETCLAMAT2 end
if Machine.Offsets.OFFSETBLAMAT2 then SawB2Offs= Machine.Offsets.OFFSETBLAMAT2 end
if Machine.Offsets.OFFSETCLAMAT2 then Saw2C1Offs= Machine.Offsets.OFFSETCLAMAT2 end
if Machine.Offsets.OFFSETBLAMAT2 then Saw2B1Offs= Machine.Offsets.OFFSETBLAMAT2 end
if Machine.Offsets.OFFSETXT1 then DeltaTabY = -Machine.Offsets.OFFSETXT1 end
if Machine.Offsets.OFFSETZT1 then DeltaTabZ = Machine.Offsets.OFFSETZT1 + MillOffs end
if Machine.Offsets.OFFSETXT2 then Delta2TabY = Machine.Offsets.OFFSETXT2 end
if Machine.Offsets.OFFSETZT2 then Delta2TabZ = -Machine.Offsets.OFFSETZT2 - Mill2Offs end
if Machine.Offsets.OFFSETZSOTTOTRAVE then DeltaRulliTraveZ = -abs( Machine.Offsets.OFFSETZSOTTOTRAVE) end
if Machine.Offsets.SECONDSAW then SecondSaw = ( Machine.Offsets.SECONDSAW == 1) end
if Machine.Offsets.SAWOFFSX then SawOffsX = Machine.Offsets.SAWOFFSX end
if Machine.Offsets.SAWOFFSZ then SawOffsZ = Machine.Offsets.SAWOFFSZ end
if Machine.Offsets.SAW2OFFSX then Saw2OffsX = Machine.Offsets.SAW2OFFSX end
if Machine.Offsets.SAW2OFFSZ then Saw2OffsZ = Machine.Offsets.SAW2OFFSZ end
if Machine.Offsets.DEFTCPOS1 then DefTcPos1 = ( 'T' .. Machine.Offsets.DEFTCPOS1) end
if Machine.Offsets.DEFTCPOS2 then DefTcPos2 = ( 'T' .. Machine.Offsets.DEFTCPOS2) end
-- aggiustamenti
@@ -206,12 +224,15 @@ if EgtExistsFile( sDataBeam) then
end
end
end
SecondSaw = ( SecondSaw and Tc2Active)
EmtGeneral {
File='Essetre-PF1250.nge',
Offset = Vector3d(0.0,1360.0,-2130.0),
AxisMaxAdjust = 300,
AxisMaxRotAdj = 0.5,
ExitMaxAdjust = 300,
ExitMaxRotAdj = 0.5,
AngDeltaMinForHome = 80,
Special = 'Essetre-PF1250.mlse',
Processor = 'Essetre-PF1250.mlpe'}
@@ -288,7 +309,7 @@ local H12Id = EmtHead {
HSet = 'H11',
Type = MCH_HT.STD,
Pos = Point3d( SawOffsX, SawOffsY, SawOffsZ),
TDir = Z_AX(),
TDir = Vector3d( 0, sin( SawB1Offs), cos( SawB1Offs)),
ADir = -X_AX(),
Rot1W = 0.5,
Rot2Stroke = { MinB1b, MaxB1b},
@@ -296,6 +317,23 @@ local H12Id = EmtHead {
Geo = 'H12_HEAD/GEO'}
EgtSetInfo( H12Id, 'ZEXTRA', '160,60')
EgtSetInfo( H12Id, 'ZMAXONROT', '1,190')
-- Lama 2
if SecondSaw then
local H16Id = EmtHead {
Name = 'H16',
Parent = 'B1',
HSet = 'H11',
Type = MCH_HT.STD,
Pos = Point3d( Saw2OffsX, Saw2OffsY, Saw2OffsZ),
TDir = Vector3d( 0, -sin( Saw2B1Offs), cos( Saw2B1Offs)),
ADir = X_AX(),
Rot1W = 0.5,
Rot2Stroke = { MinB1b, MaxB1b},
OthColl = {'B1/SOLID', 'C1/SOLID'},
Geo = 'H16_HEAD/GEO'}
EgtSetInfo( H16Id, 'ZEXTRA', '160,60')
EgtSetInfo( H16Id, 'ZMAXONROT', '1,190')
end
-- Sega a catena
EmtAxis {
Name = 'A',
@@ -593,7 +631,7 @@ if Tc2Active then
EmtTcPos {
Name = 'T12',
Parent = 'Base',
Pos = ptTc2 + 1 * vtDt2,
Pos = ptTc2 + 1 * vtDt2 + EgtIf( SecondSaw, Vector3d( -Saw2OffsX, -Saw2OffsZ, 0), V_NULL()),
TDir = -Y_AX(),
ADir = X_AX(),
Geo = 'BASE/T12'}
@@ -744,20 +782,37 @@ PY2LightId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( Y2Id, 'SOLID') or G
function OnSetHead()
-- se testa H11 (fresa)
if EMC.HEAD == 'H11' then
if GetTcForTopHeadTool( EMC.TCPOS) ~= 2 then
local nTc = GetTcForTopHeadTool( EMC.TCPOS)
if nTc ~= 2 then
EmtModifyAxisHome( 'X1', ParkX1)
else
EmtModifyAxisHome( 'X1', ParkTc2X1)
end
if EMC.TOTLEN < LongTool then
EmtModifyAxisHome( 'Z1', ParkZ1)
EmtModifyAxisStroke( 'C1', {MinC1, MaxC1})
EmtModifyAxisHome( 'C1', ParkC1)
EmtModifyAxisHome( 'B1', ParkB1)
else
EmtModifyAxisHome( 'Z1', MaxZ1)
if nTc ~= 2 then
EmtModifyAxisStroke( 'C1', { ParkLongTc1C1 - 20, ParkLongTc1C1 + 20})
EmtModifyAxisHome( 'C1', ParkLongTc1C1)
else
EmtModifyAxisStroke( 'C1', { ParkLongTc2C1 - 20, ParkLongTc2C1 + 20})
EmtModifyAxisHome( 'C1', ParkLongTc2C1)
end
EmtModifyAxisHome( 'B1', ParkB1)
end
EmtModifyAxisDirection( 'B1', X_AX())
-- se testa H12 (lama)
elseif EMC.HEAD == 'H12' then
EmtModifyAxisHome( 'X1', ParkX1)
EmtModifyAxisHome( 'Z1', ParkZ1)
EmtModifyAxisStroke( 'C1', {MinC1, MaxC1})
EmtModifyAxisHome( 'C1', ParkC1)
EmtModifyAxisHome( 'B1', ParkB1)
EmtModifyAxisDirection( 'B1', Vector3d( cos( SawC1Offs), -sin( SawC1Offs), 0))
-- se testa H13 (sega a catena)
elseif EMC.HEAD == 'H13' then
-- aggiustamenti per distanza
@@ -771,8 +826,18 @@ function OnSetHead()
CSawPosA = tonumber( sVal:sub( 3) or '')
EmtModifyAxisHome( 'X1', ParkCSawX1)
EmtModifyAxisHome( 'Z1', GetChainSawZHomeFromVirtualAxis( CSawPosA))
EmtModifyAxisStroke( 'C1', {MinC1, MaxC1})
EmtModifyAxisHome( 'C1', GetChainSawCHomeFromVirtualAxis( CSawPosA))
EmtModifyAxisHome( 'B1', ParkCSawB1)
EmtModifyAxisDirection( 'B1', X_AX())
-- se testa H16 ( seconda lama)
elseif EMC.HEAD == 'H16' then
EmtModifyAxisHome( 'X1', ParkTc2X1)
EmtModifyAxisHome( 'Z1', ParkZ1)
EmtModifyAxisStroke( 'C1', {MinC1, MaxC1})
EmtModifyAxisHome( 'C1', ParkC1)
EmtModifyAxisHome( 'B1', ParkB1)
EmtModifyAxisDirection( 'B1', Vector3d( cos( Saw2C1Offs), sin( Saw2C1Offs), 0))
end
end
+344 -155
View File
@@ -1,4 +1,4 @@
-- Processore macchina Essetre-PF1250 by EgalTech s.r.l. 2023/05/10
-- Processore macchina Essetre-PF1250 by EgalTech s.r.l. 2023/11/21
-- Funzioni generiche indipendenti dal controllo
-- Intestazioni
@@ -28,7 +28,6 @@ function OnSimulStart()
if not EMT.VER or EMT.VER < '2.5d1' then
EmtSetLastError( 1200, 'A newer version of the program is required (minimum EgtMachKernel 2.5d1)')
end
ExecStartHome()
-- Carico gli utensili sulle barre portautensili
local vTcPos = EgtGetAllTcPosNames()
if vTcPos then
@@ -40,6 +39,10 @@ function OnSimulStart()
end
end
end
-- Carico gli utensili iniziali o di default sulle due teste
LoadFirstTool( 1, DefTcPos1)
LoadFirstTool( 2, DefTcPos2)
ExecStartHome()
-- Se reset o home, esco
if EMT.SIM1ST then return end
-- Creo o svuoto gruppo per copia finale degli oggetti virtual milling
@@ -124,15 +127,12 @@ function OnSimulDispositionStart()
-- Determino sezione del grezzo
local nSolId = EgtGetFirstNameInGroup( EgtGetFirstRawPart() or GDB_ID.NULL, 'RawSolid') or GDB_ID.NULL
local b3Sol = EgtGetBBoxGlob( nSolId, GDB_BB.STANDARD)
EMT.SB = 0
EMT.HB = 0
EMT.SB = 0
if b3Sol then
EMT.SB = b3Sol:getDimY()
EMT.HB = b3Sol:getDimZ()
EMT.HB = b3Sol:getDimY()
EMT.SB = b3Sol:getDimZ()
end
-- Carico gli utensili iniziali o di default sulle due teste
LoadFirstTool( 1, DefTcPos1)
LoadFirstTool( 2, DefTcPos2)
-- Se vero inizio e abilitato creo gli Zmap
EMT.VMILL = {}
if not EMT.SIM1ST and EgtGetInfo( EgtGetCurrMachGroup(), 'Vm', 'b') then
@@ -190,8 +190,6 @@ function OnSimulDispositionStart()
end
nPartRawId = EgtGetNextRawPart( nPartRawId)
end
-- imposto eventuale utensile corrente
SetToolForVmill( EMT.TOOL, EMT.HEAD, EMT.EXIT, EMT.VMILL)
end
end
@@ -249,7 +247,8 @@ function OnSimulDispositionStart()
EMT.SCRAP = nil
end
EMT.LB = b3Bar:getDimX()
EMT.LT = b3Part:getDimX()
EMT.LT = b3Raw:getDimX()
EMT.LP = b3Part:getDimX()
EMT.CUTID = EgtGetInfo( EgtGetFirstPartInRawPart( nPartRawId or GDB_ID.NULL) or GDB_ID.NULL, 'CUTID', 'i') or 0
EMT.Y1SPEC = nil
-- se vero inizio, assegno solidi per verifica collisione
@@ -386,6 +385,14 @@ function OnSimulToolSelect( dPosA)
if EMT.TOOL == '' then return end
-- recupero dati utensile
EMT.TOOLTYPE = EgtTdbGetCurrToolParam( MCH_TP.TYPE)
EMT.TLEN = EgtTdbGetCurrToolParam( MCH_TP.LEN)
EMT.TTOTLEN = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES)
-- se fresa o lama su testa 1, reset assi rotanti
if EMT.HEAD == 'H11' or EMT.HEAD == 'H12' or EMT.HEAD == 'H13' or EMT.HEAD == 'H16' then
EgtResetAxisPos( 'C1')
EgtResetAxisPos( 'B1')
end
-- se sega a catena, imposto subito angolo scelto per asse virtuale A
if EMT.HEAD == 'H13' then
-- valore dell'asse virtuale
@@ -411,12 +418,12 @@ function OnSimulToolSelect( dPosA)
EMT.A3n = 'V1'
EMT.A4n = 'V2'
-- se attivo Vmill
SetToolForVmill( EMT.TOOL, EMT.HEAD, EMT.EXIT, EMT.VMILL)
EmtSetToolForVmill( EMT.TOOL, EMT.HEAD, EMT.EXIT, EMT.VMILL)
-- se attivo Collision Check
EMT.SAFEDIST = COLL_SAFE_DIST
if EMT.COLLOBJ then
local nInd = EgtIf( EMT.HEAD ~= 'H21', 1001, 1011)
AddToolToCollisionObj( EMT.TOOL, EMT.HEAD, EMT.EXIT, nInd)
AddToolToCollisionObj( EMT.TOOL, EMT.HEAD, EMT.EXIT, nInd, true)
AddToolHolderToCollisionObj( EMT.TOOL, EMT.HEAD, EMT.EXIT, nInd + 1)
for i, Coll in ipairs( EMT.COLLOBJ or {}) do
EmtAddCollisionObjEx( i, Coll.Fr, Coll.Ty, Coll.Mv, Coll.P1, Coll.P2, Coll.P3)
@@ -442,19 +449,31 @@ function OnSimulToolDeselect( dPrevA)
EgtSetStatus( EgtGetHeadId( EMT.PREVHEAD_H2 or '') or GDB_ID.NULL, GDB_ST.OFF)
return
end
-- per testa gruppo 1...
local RapSimStep = 4 * EMT.SIMSTEP
-- Testa gruppo 1...
-- deposito utensile fresa
if EMT.PREVHEAD_H1 == 'H11' then
-- simulo movimento
SimulMoveAxes( 'B1', ParkB1, RapSimStep/10, 'C1', ParkC1, RapSimStep/10)
local dPosX = EgtIf( GetTcForTopHeadTool( EMT.PREVTCPOS_H1) ~= 2, ParkX1, ParkTc2X1)
SimulMoveAxis( 'X1', dPosX, RapSimStep)
local nPrevTc = GetTcForTopHeadTool( EMT.PREVTCPOS_H1)
if EMT.PREVTTOTLEN_H1 < LongTool then
SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT)
local dPosX = EgtIf( nPrevTc ~= 2, ParkX1, ParkTc2X1)
SimulMoveAxis( 'X1', dPosX, MCH_SIM_STEP.RAPID)
else
if nPrevTc ~= 2 then
SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkLongTc1C1, MCH_SIM_STEP.RAPROT)
local dPosX = ParkX1
SimulMoveAxis( 'X1', dPosX, MCH_SIM_STEP.RAPID)
else
SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkLongTc2C1, MCH_SIM_STEP.RAPROT)
local dPosX = ParkTc2X1
SimulMoveAxis( 'X1', dPosX, MCH_SIM_STEP.RAPID)
end
end
-- deposito utensile lama
elseif EMT.PREVHEAD_H1 == 'H12' then
-- simulo movimento
SimulMoveAxes( 'B1', ParkB1, RapSimStep/10, 'C1', ParkC1, RapSimStep/10)
SimulMoveAxis( 'X1', ParkX1, RapSimStep)
SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT)
SimulMoveAxis( 'X1', ParkX1, MCH_SIM_STEP.RAPID)
-- deposito utensile sega a catena
elseif EMT.PREVHEAD_H1 == 'H13' then
-- simulo movimento
@@ -462,8 +481,13 @@ function OnSimulToolDeselect( dPrevA)
if dPrevA then
ParkC1 = GetChainSawCHomeFromVirtualAxis( dPrevA)
end
SimulMoveAxes( 'B1', ParkCSawB1, RapSimStep/10, 'C1', ParkC1, RapSimStep/10)
SimulMoveAxis( 'X1', ParkCSawX1, RapSimStep)
SimulMoveAxes( 'B1', ParkCSawB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT)
SimulMoveAxis( 'X1', ParkCSawX1, MCH_SIM_STEP.RAPID)
-- deposito utensile seconda lama
elseif EMT.PREVHEAD_H1 == 'H16' then
-- simulo movimento
SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT)
SimulMoveAxis( 'X1', ParkTc2X1, MCH_SIM_STEP.RAPID)
end
-- breve pausa
EgtPause( 100)
@@ -474,20 +498,25 @@ function OnSimulToolDeselect( dPrevA)
-- prendo utensile fresa
if EMT.NEXTHEAD == 'H11' then
-- simulo movimento
SimulMoveAxes( 'B1', ParkB1, RapSimStep/10, 'C1', ParkC1, RapSimStep/10)
SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT)
local dPosX = EgtIf( GetTcForTopHeadTool( EMT.NEXTTCPOS) ~= 2, ParkX1, ParkTc2X1)
SimulMoveAxis( 'X1', dPosX, RapSimStep)
SimulMoveAxis( 'Z1', 0, RapSimStep)
SimulMoveAxis( 'X1', dPosX, MCH_SIM_STEP.RAPID)
SimulMoveAxis( 'Z1', 0, MCH_SIM_STEP.RAPID)
-- prendo utensile lama
elseif EMT.NEXTHEAD == 'H12' then
-- simulo movimento
SimulMoveAxes( 'B1', ParkB1, RapSimStep/10, 'C1', ParkC1, RapSimStep/10)
SimulMoveAxis( 'X1', ParkX1, RapSimStep)
SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT)
SimulMoveAxis( 'X1', ParkX1, MCH_SIM_STEP.RAPID)
-- prendo utensile sega a catena
elseif EMT.NEXTHEAD == 'H13' then
-- simulo movimento
SimulMoveAxes( 'B1', ParkCSawB1, RapSimStep/10, 'C1', EgtGetAxisHomePos( 'C1'), RapSimStep/10)
SimulMoveAxis( 'X1', ParkCSawX1, RapSimStep)
SimulMoveAxes( 'B1', ParkCSawB1, MCH_SIM_STEP.RAPROT, 'C1', EgtGetAxisHomePos( 'C1'), MCH_SIM_STEP.RAPROT)
SimulMoveAxis( 'X1', ParkCSawX1, MCH_SIM_STEP.RAPID)
-- prendo utensile seconda lama
elseif EMT.NEXTHEAD == 'H16' then
-- simulo movimento
SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT)
SimulMoveAxis( 'X1', ParkTc2X1, MCH_SIM_STEP.RAPID)
end
end
@@ -511,18 +540,20 @@ function OnSimulMachiningStart()
EMT.PREVTOOL_H1 = EMT.TOOL
EMT.PREVHEAD_H1 = EMT.HEAD
EMT.PREVTCPOS_H1 = EMT.TCPOS
EMT.PREVTTOTLEN_H1 = EMT.TTOTLEN
-- per gruppo testa 2
elseif nSetHead == 2 then
EMT.PREVTOOL_H2 = EMT.TOOL
EMT.PREVHEAD_H2 = EMT.HEAD
EMT.PREVTCPOS_H2 = EMT.TCPOS
EMT.PREVTTOTLEN_H2 = EMT.TTOTLEN
end
-- recupero alcuni dati della lavorazione
EMT.MCHNAME = EgtGetOperationName( EMT.MCHID)
EMT.MCHTYPE = EgtGetMachiningParam( MCH_MP.TYPE)
local sNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
EMT.VMRS = ( EMT.MCHTYPE ~= MCH_MY.DRILLING and not ( sNotes and sNotes:find( 'VMRS=0;', 1, true)))
EMT.MCHSPLIT = ( sNotes and sNotes:find( 'Split;', 1, true))
EMT.MCHUSERNOTES = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
EMT.VMRS = ( EMT.MCHTYPE ~= MCH_MY.DRILLING and not EMT.MCHUSERNOTES:find( 'VMRS=0;', 1, true))
EMT.MCHSPLIT = ( EMT.MCHUSERNOTES:find( 'Split;', 1, true) ~= nil)
-- recupero TASKID e CUTID della feature lavorata (CUTID va recuperato qui per le pareti)
local vId = EgtGetMachiningGeometry()
if vId and #vId > 0 and #vId[1] > 0 then
@@ -533,6 +564,47 @@ function OnSimulMachiningStart()
EMT.CUTID = 0
EMT.TASKID = 0
end
-- gestione eventuale lavorazione in doppio
local nDouType = EgtGetValInNotes( EMT.MCHUSERNOTES, 'DOUBLE', 'i')
if nDouType == 2 or nDouType == 3 then
local sDouTool = EgtGetValInNotes( EMT.TUSERNOTES, 'DOUBLE', 's') or ''
local sOldTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
if EgtTdbSetCurrTool( sDouTool) and EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) then
local sDouHead = 'H21'
local nDouExit = 1
-- carico l'utensile sulla testa
local sTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
EgtLoadTool( sDouHead, nDouExit, sDouTool)
ShowToolInTcPos( sTcPos, false)
-- dichiaro utensile per Vmill
EmtAddToolForVmill( sDouTool, sDouHead, nDouExit, EMT.VMILL)
-- dichiaro utensile per verifica collisioni
local nInd = 1011
AddToolToCollisionObj( sDouTool, sDouHead, nDouExit, nInd, true)
AddToolHolderToCollisionObj( sDouTool, sDouHead, nDouExit, nInd + 1)
-- salvo dati
EMT.DOU_TLEN = EgtTdbGetCurrToolParam( MCH_TP.LEN)
EMT.DOU_TTOTLEN = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
EMT.DOU_TYPE = nDouType
EMT.DOU_TOOL = sDouTool
-- reset necessità movimento in sicurezza sola testa in doppio
EMT.DOU_TO_ZMAX = nil
else
EmtSetLastError( 1211, 'Missing or not active double tool of '..sOldTool)
end
EgtTdbSetCurrTool( sOldTool)
end
-- se precedente in doppio ma ora solo testa 1 e non in sicurezza
if EMT.DOU_TO_ZMAX then
-- parcheggio i rulli
local bAgg = EgtExistsInfo( EMT.PATHID, 'CNT')
ExecParkRoller( nil, nil, nil, nil, false, bAgg)
-- eseguo
SimulMoveAxes( 'Z2', MinZ2, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B2', ParkB2, MCH_SIM_STEP.COLLROT, 'C2', ParkC2, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID)
EMT.DOU_TO_ZMAX = nil
end
-- non ancora iniziata la lavorazione
EMT.MCHFIRST = true
end
@@ -547,6 +619,9 @@ function OnSimulMachiningEnd()
end
EMT.MCHSPLIT = nil
EMT.SPLIT = nil
if EMT.DOU_TYPE and not EMT.ZMAX then EMT.DOU_TO_ZMAX = EMT.DOU_TYPE end
EMT.DOU_TYPE = nil
EMT.DOU_TOOL = nil
end
---------------------------------------------------------------------
@@ -602,10 +677,6 @@ end
---------------------------------------------------------------------
function OnSimulMoveStart()
if EMT.MCHFIRST then EgtOutText( '') end
-- step di simulazione
local RapSimStep = 4 * EMT.SIMSTEP
local RapSimRotStep = RapSimStep / 10
local CollSimRotStep = min( RapSimRotStep, 10)
-- set della testa
local nSetHead = GetHeadSet( EMT.HEAD)
-- Posizioni correnti
@@ -682,35 +753,42 @@ function OnSimulMoveStart()
local B1Pos = EgtGetAxisPos( 'B1')
local Z1Pos = EgtGetAxisPos( 'Z1')
local Z1Home = EgtGetAxisHomePos( 'Z1')
-- se movimento iniziale da Zmax con lama o fresa
if EMT.ZMAX or ( EMT.FLAG == 2 and EMT.FLAG2 == 1) then
-- se fresa o lama
if EMT.HEAD ~= 'H13' then
SimulMoveAxis( 'X1', EMT.L2, RapSimStep)
-- se movimento iniziale da Zmax con lama o fresa
if EMT.ZMAX or ( EMT.FLAG == 2 and EMT.FLAG2 == 1) then
if EMT.TTOTLEN < LongTool then
--EgtOutBox( 'Flag 2,1', 'Info Rapid')
local bXSpec = ( EMT.L2 < DeltaTabY)
SimulMoveAxis( 'X1', EMT.L2, MCH_SIM_STEP.RAPID)
local Z_EXTRA = EgtIf( EMT.HEAD == 'H11', 250, 160)
local dZref
if EMT.R2 > -60 then
dZref = Z1Home + Z_EXTRA
SimulMoveAxes( 'Z1', dZref, RapSimStep, 'B1', min( EMT.R2, 60), CollSimRotStep)
SimulMoveAxes( 'Z1', dZref, MCH_SIM_STEP.RAPID, 'B1', min( EMT.R2, 60), MCH_SIM_STEP.COLLROT)
if EMT.R2 > 60 then
dZref = Z1Home + Z_EXTRA * ( 90 - abs( EMT.R2)) / 30
SimulMoveAxes( 'Z1', dZref, RapSimStep, 'B1', min( EMT.R2, 90), CollSimRotStep)
SimulMoveAxes( 'Z1', dZref, MCH_SIM_STEP.RAPID, 'B1', min( EMT.R2, 90), MCH_SIM_STEP.COLLROT)
end
else
dZref = Z1Home + Z_EXTRA * ( 90 - abs( EMT.R2)) / 30
SimulMoveAxes( 'Z1', dZref, RapSimStep, 'B1', EMT.R2, CollSimRotStep)
SimulMoveAxes( 'Z1', dZref, MCH_SIM_STEP.RAPID, 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
end
if dZref and EMT.L3 < dZref + 0.1 then
SimulMoveAxis( 'C1', EMT.R1, CollSimRotStep)
SimulMoveAxis( 'C1', EMT.R1, MCH_SIM_STEP.COLLROT)
if bXSpec and EMT.L3 < dZref - 0.1 then
SimulMoveAxis( 'X1', EMT.L2, MCH_SIM_STEP.RAPID)
end
end
end
end
-- altrimenti sega a catena
else
local bXSpec = ( EMT.L2 > DeltaTabY)
SimulMoveAxis( 'X1', EgtIf( bXSpec, DeltaTabY, EMT.L2), RapSimStep)
SimulMoveAxis( 'Z1', Z1Home, RapSimStep)
SimulMoveAxis( 'X1', EgtIf( bXSpec, DeltaTabY, EMT.L2), MCH_SIM_STEP.RAPID)
SimulMoveAxis( 'Z1', Z1Home, MCH_SIM_STEP.RAPID)
if bXSpec then
SimulMoveAxes( 'C1', EMT.R1, CollSimRotStep, 'B1', EMT.R2, CollSimRotStep)
end
SimulMoveAxes( 'C1', EMT.R1, MCH_SIM_STEP.COLLROT, 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
end
end
-- altrimenti testa 2
@@ -719,11 +797,10 @@ function OnSimulMoveStart()
local X2Pos = EgtGetAxisPos( 'X2')
local X2Home = EgtGetAxisHomePos( 'X2')
if X2Pos > X2Home - 1 then
SimulMoveAxis( 'X2', EMT.L2, RapSimStep)
SimulMoveAxis( 'X2', EMT.L2, MCH_SIM_STEP.RAPID)
end
end
end
EMT.ZMAX = nil
-- se lavorazione split, muovo per riaggancio del carro Y1
if EMT.SPLIT_Y1DELTA then
EMT.Y1DELTA = EMT.SPLIT_Y1DELTA
@@ -735,24 +812,90 @@ function OnSimulMoveStart()
EMT.EnabAxes = false
EMT.ShowAxes = true
end
-- se lavorazione in doppio
if not ( EMT.MOVE == 0 and EMT.FLAG == 3) then
-- doppio in orizzontale
if EMT.DOU_TYPE == 2 then
-- se primo movimento, eseguo movimento rotatorio preliminare
if EMT.ZMAX or ( EMT.FLAG == 2 and EMT.FLAG2 == 1) then
SimulMoveAxes( 'C2', EMT.R1, MCH_SIM_STEP.RAPROT, 'B2', EMT.R2, MCH_SIM_STEP.RAPROT)
else
EMT.AuxAxes = 4 + 4
EMT.A5n = 'X2'
local X2 = Delta2TabY + EMT.DOU_TLEN - ( -DeltaTabY + EMT.L2 + EMT.TLEN - EMT.HB)
if EMT.MCHTYPE == MCH_MY.DRILLING and EMT.FLAG == 101 then
EMT.DOU_DRILL_END = -( EMT.L2p - EMT.L2)
X2 = X2 + 2 * EMT.DOU_DRILL_END
end
EMT.A5 = X2
EMT.A5m = nil
EMT.A6n = 'Z2'
local Z2 = -Head2Z + MillOffs + Mill2Offs + EMT.L3
EMT.A6 = EgtClamp( Z2, MinZ2, MaxZ2)
EMT.A6m = EgtIf( ( EMT.MOVE == 2 or EMT.MOVE == 3), 'Z1', nil)
EMT.A7n = 'C2'
EMT.A7 = EMT.R1
EMT.A8n = 'B2'
EMT.A8 = EMT.R2
-- controllo minima distanza tra utensili di X1 e X2
local dDeltaX1X2 = EMT.L2 - EMT.A5 - Head2Y
local dDistToolX1X2 = -dDeltaX1X2 - MillOffs - EMT.TTOTLEN - Mill2Offs - EMT.DOU_TTOTLEN
if dDistToolX1X2 < MinDistToolX1X2 then
local sErr = 'X1 X2 tools in collision (distance=' .. EgtNumToString( dDistToolX1X2, 1) .. ')'
EmtSetLastError( 1208, sErr)
end
-- se appena sopra inizio, sistemo subito la quota in Z
if EMT.MOVE == 0 and EMT.FLAG == 1 then
SimulMoveAxes( 'Z2', EMT.A6, MCH_SIM_STEP.RAPID)
end
end
-- doppio in verticale
elseif EMT.DOU_TYPE == 3 then
EMT.AuxAxes = 4 + 4
EMT.A5n = 'X2'
local X2 = -Head2Y + EMT.L2
EMT.A5 = X2
EMT.A5m = EgtIf( ( EMT.MOVE == 2 or EMT.MOVE == 3), 'X1', nil)
EMT.A6n = 'Z2'
local Z2 = Delta2TabZ - EMT.DOU_TLEN - ( -DeltaTabZ + EMT.L3 - EMT.TLEN - EMT.SB)
if EMT.MCHTYPE == MCH_MY.DRILLING and EMT.FLAG == 101 then
EMT.DOU_DRILL_END = EMT.L3p - EMT.L3
Z2 = Z2 - 2 * EMT.DOU_DRILL_END
end
EMT.A6 = EgtClamp( Z2, MinZ2, MaxZ2)
EMT.A6m = nil
EMT.A7n = 'C2'
EMT.A7 = EMT.R1
EMT.A8n = 'B2'
EMT.A8 = EMT.R2
-- controllo minima distanza tra utensili di X1 e X2 (lungo Z)
local dDeltaZ1Z2 = EMT.L3 - EMT.A6 - Head2Z
local dDistToolZ1Z2 = dDeltaZ1Z2 - EMT.TTOTLEN - EMT.DOU_TTOTLEN
if dDistToolZ1Z2 < MinDistToolX1X2 then
local sErr = 'Z1 Z2 tools in collision (distance=' .. EgtNumToString( dDistToolZ1Z2, 1) .. ')'
EmtSetLastError( 1208, sErr)
end
end
end
-- se necessario ...
if EMT.MCHFIRST then
if nSetHead == 1 then
SimulMoveAxes( 'X1', EMT.L2, RapSimStep,
'Z1', EMT.L3, RapSimStep,
'C1', EMT.R1, RapSimRotStep,
'B1', EMT.R2, RapSimRotStep)
SimulMoveAxes( 'X1', EMT.L2, MCH_SIM_STEP.RAPID,
'Z1', EMT.L3, MCH_SIM_STEP.RAPID,
'C1', EMT.R1, MCH_SIM_STEP.RAPROT,
'B1', EMT.R2, MCH_SIM_STEP.RAPROT)
else
SimulMoveAxes( 'X2', EMT.L2, RapSimStep,
'Z2', EMT.L3, RapSimStep,
'C2', EMT.R1, RapSimRotStep,
'B2', EMT.R2, RapSimRotStep)
SimulMoveAxes( 'X2', EMT.L2, MCH_SIM_STEP.RAPID,
'Z2', EMT.L3, MCH_SIM_STEP.RAPID,
'C2', EMT.R1, MCH_SIM_STEP.RAPROT,
'B2', EMT.R2, MCH_SIM_STEP.RAPROT)
end
end
if nRes ~= 0 then
EMT.A3 = EgtIf( GetV1ToClose(), EMT.V1NEXTPOS, ParkV1)
EMT.A4 = EgtIf( GetV2ToClose(), EMT.V2NEXTPOS, ParkV2)
end
EMT.ZMAX = nil
end
---------------------------------------------------------------------
@@ -779,6 +922,20 @@ function OnSimulMoveEnd()
EMT.MCHFIRST = false
EgtOutText( '')
end
-- se movimento finale di foratura in doppio in Z
if EMT.MCHTYPE == MCH_MY.DRILLING and EMT.FLAG == 101 then
if EMT.DOU_TYPE == 2 then
SimulMoveAxes( 1, 'X1', EMT.L2 - 2 * EMT.DOU_DRILL_END, MCH_SIM_STEP.FEED,
'X2', EMT.A5 - 2 * EMT.DOU_DRILL_END, MCH_SIM_STEP.FEED)
SimulMoveAxes( 1, 'X1', EMT.L2 - EMT.DOU_DRILL_END, MCH_SIM_STEP.FEED,
'X2', EMT.A5 - EMT.DOU_DRILL_END, MCH_SIM_STEP.FEED)
elseif EMT.DOU_TYPE == 3 then
SimulMoveAxes( 1, 'Z1', EMT.L3 + 2 * EMT.DOU_DRILL_END, MCH_SIM_STEP.FEED,
'Z2', EMT.A6 + 2 * EMT.DOU_DRILL_END, MCH_SIM_STEP.FEED)
SimulMoveAxes( 1, 'Z1', EMT.L3 + EMT.DOU_DRILL_END, MCH_SIM_STEP.FEED,
'Z2', EMT.A6 + EMT.DOU_DRILL_END, MCH_SIM_STEP.FEED)
end
end
-- se Zmax dopo fine lavorazione
if EMT.MOVE == 0 and EMT.FLAG == 3 then
-- eventuale rimozione sfridi
@@ -816,8 +973,6 @@ end
---------------------------------------------------------------------
function ExecAuxCmd( sCmd)
-- step di simulazione per rapido
local RapSimStep = 4 * EMT.SIMSTEP
-- analizzo il comando
local Cmd = EgtSplitString( sCmd)
if Cmd[1] == '0' then
@@ -833,9 +988,9 @@ function ExecAuxCmd( sCmd)
if EMT.SPLIT then ExecOpenRoller( 1) end
if EMT.UNLOADING or EMT.TO_FALL then ExecOpenRoller( 2) end
local sV1, MoveV1, sV2, MoveV2 = CalcMoveV1V2ForAuxCmd( Cmd)
local bOk, bOk1, bOk2, bOk3 = SimulMoveAxes( Cmd[2], tonumber( Cmd[3]), RapSimStep,
sV1, MoveV1, RapSimStep,
sV2, MoveV2, RapSimStep)
local bOk, bOk1, bOk2, bOk3 = SimulMoveAxes( Cmd[2], tonumber( Cmd[3]), MCH_SIM_STEP.RAPID,
sV1, MoveV1, MCH_SIM_STEP.RAPID,
sV2, MoveV2, MCH_SIM_STEP.RAPID)
if not bOk then
if not bOk1 then
if VerifyY1Y2Stroke( Cmd[2], tonumber( Cmd[3])) == nil then
@@ -854,10 +1009,10 @@ function ExecAuxCmd( sCmd)
if EMT.SPLIT then ExecOpenRoller( 1) end
if EMT.UNLOADING or EMT.TO_FALL then ExecOpenRoller( 2) end
local sV1, MoveV1, sV2, MoveV2 = CalcMoveV1V2ForAuxCmd( Cmd)
local bOk, bOk1, bOk2, bOk3, bOk4 = SimulMoveAxes( Cmd[2], tonumber( Cmd[3]), RapSimStep,
Cmd[4], tonumber( Cmd[5]), RapSimStep,
sV1, MoveV1, RapSimStep,
sV2, MoveV2, RapSimStep)
local bOk, bOk1, bOk2, bOk3, bOk4 = SimulMoveAxes( Cmd[2], tonumber( Cmd[3]), MCH_SIM_STEP.RAPID,
Cmd[4], tonumber( Cmd[5]), MCH_SIM_STEP.RAPID,
sV1, MoveV1, MCH_SIM_STEP.RAPID,
sV2, MoveV2, MCH_SIM_STEP.RAPID)
if not bOk then
if not bOk1 or not bOk2 then
local nI = EgtIf( not bOk1, 2, 4)
@@ -877,11 +1032,11 @@ function ExecAuxCmd( sCmd)
if EMT.SPLIT then ExecOpenRoller( 1) end
if EMT.UNLOADING or EMT.TO_FALL then ExecOpenRoller( 2) end
local sV1, MoveV1, sV2, MoveV2 = CalcMoveV1V2ForAuxCmd( Cmd)
local bOk, bOk1, bOk2, bOk3, bOk4, bOk5 = SimulMoveAxes( Cmd[2], tonumber( Cmd[3]), RapSimStep,
Cmd[4], tonumber( Cmd[5]), RapSimStep,
Cmd[6], tonumber( Cmd[7]), RapSimStep,
sV1, MoveV1, RapSimStep,
sV2, MoveV2, RapSimStep)
local bOk, bOk1, bOk2, bOk3, bOk4, bOk5 = SimulMoveAxes( Cmd[2], tonumber( Cmd[3]), MCH_SIM_STEP.RAPID,
Cmd[4], tonumber( Cmd[5]), MCH_SIM_STEP.RAPID,
Cmd[6], tonumber( Cmd[7]), MCH_SIM_STEP.RAPID,
sV1, MoveV1, MCH_SIM_STEP.RAPID,
sV2, MoveV2, MCH_SIM_STEP.RAPID)
if not bOk then
if not bOk1 or not bOk2 or not bOk3 then
local nI = EgtIf( not bOk1, 2, EgtIf( not bOk2, 4, 6))
@@ -897,10 +1052,10 @@ function ExecAuxCmd( sCmd)
elseif Cmd[1] == '4' then
ExecMoveHome( Cmd[2] == '1', EMT.MCHSPLIT)
elseif Cmd[1] == '11' then
SimulMoveAxes( 'PY1', EgtIf( Cmd[2] == '0', MaxHoOpen, EMT.SB), RapSimStep)
SimulMoveAxes( 'PY1', EgtIf( Cmd[2] == '0', MaxHoOpen, EMT.HB), MCH_SIM_STEP.RAPID)
SetPY1Light( Cmd[2] ~= '0')
elseif Cmd[1] == '12' then
SimulMoveAxes( 'PY2', EgtIf( Cmd[2] == '0', MaxHoOpen, EMT.SB), RapSimStep)
SimulMoveAxes( 'PY2', EgtIf( Cmd[2] == '0', MaxHoOpen, EMT.HB), MCH_SIM_STEP.RAPID)
SetPY2Light( Cmd[2] ~= '0')
elseif Cmd[1] == '21' then
local nY1Delta = tonumber( Cmd[2])
@@ -951,27 +1106,25 @@ end
---------------------------------------------------------------------
function ExecStartHome()
-- posizioni di home
local HomeX = EgtGetAxisHomePos( 'X1')
local HomeC = EgtGetAxisHomePos( 'C1')
local HomeB = EgtGetAxisHomePos( 'B1')
local MaxZ = 0
-- posizionamento istantaneo
EgtSetAxisPos( 'X1', HomeX)
EgtSetAxisPos( 'C1', HomeC)
EgtSetAxisPos( 'B1', HomeB)
EgtSetAxisPos( 'Z1', MaxZ)
-- Testa 1
EgtResetAxisPos( 'X1')
EgtSetAxisPos( 'Z1', MaxZ1)
EgtResetAxisPos( 'C1')
EgtResetAxisPos( 'B1')
-- Testa 2
EgtResetAxisPos( 'X2')
EgtSetAxisPos( 'Z2', MinZ2)
EgtResetAxisPos( 'C2')
EgtResetAxisPos( 'B2')
end
---------------------------------------------------------------------
function ExecMoveHome( bNearV, bMchSplit)
-- risalita a Zmax
ExecMoveZmax( bMchSplit)
-- step di simulazione
local RapSimStep = 4 * EMT.SIMSTEP
-- se testa sotto
if GetHeadSet( EMT.HEAD) == 2 then
if not SimulMoveAxis( 'X2', ParkX2, RapSimStep) then
if not SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID) then
EgtOutLog( 'Error on MoveHome : X2')
end
end
@@ -979,8 +1132,8 @@ function ExecMoveHome( bNearV, bMchSplit)
if bNearV then
ExecOpenRoller( 1)
ExecOpenRoller( 2)
if not SimulMoveAxes( 'V1', MinV1, RapSimStep,
'V2', MaxV2, RapSimStep) then
if not SimulMoveAxes( 'V1', MinV1, MCH_SIM_STEP.RAPID,
'V2', MaxV2, MCH_SIM_STEP.RAPID) then
EgtOutLog( 'Error on MoveHome : NearV1V2')
end
end
@@ -988,10 +1141,6 @@ end
---------------------------------------------------------------------
function ExecMoveZmax( bMchSplit)
-- step di simulazione
local RapSimStep = 4 * EMT.SIMSTEP
local RapSimRotStep = RapSimStep / 10
local CollSimRotStep = min( RapSimRotStep, 10)
-- set della testa
local nSetHead = GetHeadSet( EMT.HEAD)
-- posizioni correnti degli assi testa
@@ -1000,6 +1149,7 @@ function ExecMoveZmax( bMchSplit)
local CurrC = EgtGetAxisPos( EgtIf( nSetHead == 1, 'C1', 'C2'))
local CurrB = EgtGetAxisPos( EgtIf( nSetHead == 1, 'B1', 'B2'))
-- posizioni home degli assi testa
local HomeX = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'X1', 'X2'))
local HomeZ = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'Z1', 'Z2'))
local HomeC = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'C1', 'C2'))
local HomeB = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'B1', 'B2'))
@@ -1017,43 +1167,70 @@ function ExecMoveZmax( bMchSplit)
-- se fresa o lama
if EMT.HEAD ~= 'H13' then
if abs( HomeC - CurrC) > 0.1 or abs( HomeB - CurrB) > 0.1 then
if EMT.TTOTLEN < LongTool then
local bSafeZ = false
local Z_EXTRA = EgtIf( EMT.HEAD == 'H11', 250, 160)
if abs( CurrB) < 60 then
local dZref = HomeZ + Z_EXTRA
SimulMoveAxis( 'Z1', dZref, RapSimStep)
SimulMoveAxis( 'Z1', dZref, MCH_SIM_STEP.RAPID)
bSafeZ = true
elseif abs( CurrB) < 90 then
local dZref = HomeZ + Z_EXTRA * ( 90 - abs( CurrB)) / 30
SimulMoveAxis( 'Z1', dZref, RapSimStep)
SimulMoveAxis( 'Z1', dZref, MCH_SIM_STEP.RAPID)
bSafeZ = true
end
if CurrX < DeltaTabY then
if not bSafeZ then
SimulMoveAxes( 'Z1', HomeZ, MCH_SIM_STEP.RAPID, 'B1', EgtIf( CurrB > 0, 90, -90), MCH_SIM_STEP.COLLROT)
end
SimulMoveAxis( 'X1', DeltaTabY, MCH_SIM_STEP.RAPID)
end
local ANG_LIM_DOWN = EgtIf( EMT.HEAD == 'H11', 0, -45)
local ANG_LIM_OPPO = 90
if CurrB > ANG_LIM_DOWN then
if CurrB > ANG_LIM_OPPO then
SimulMoveAxes( 'Z1', HomeZ, RapSimStep, 'B1', ANG_LIM_OPPO, CollSimRotStep)
SimulMoveAxes( 'Z1', HomeZ, MCH_SIM_STEP.RAPID, 'B1', ANG_LIM_OPPO, MCH_SIM_STEP.COLLROT)
end
if CurrB > 60 then
SimulMoveAxes( 'Z1', HomeZ + Z_EXTRA, RapSimStep, 'B1', 60, CollSimRotStep)
SimulMoveAxes( 'Z1', HomeZ + Z_EXTRA, MCH_SIM_STEP.RAPID, 'B1', 60, MCH_SIM_STEP.COLLROT)
end
SimulMoveAxes( 'Z1', HomeZ + Z_EXTRA, RapSimStep, 'B1', ANG_LIM_DOWN, CollSimRotStep)
SimulMoveAxes( 'Z1', HomeZ + Z_EXTRA, MCH_SIM_STEP.RAPID, 'B1', ANG_LIM_DOWN, MCH_SIM_STEP.COLLROT)
end
SimulMoveAxes( 'Z1', HomeZ, RapSimStep, 'B1', HomeB, CollSimRotStep)
SimulMoveAxis( 'C1', HomeC, CollSimRotStep)
SimulMoveAxes( 'Z1', HomeZ, MCH_SIM_STEP.RAPID, 'B1', HomeB, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'C1', HomeC, MCH_SIM_STEP.COLLROT)
else
SimulMoveAxis( 'Z1', HomeZ, MCH_SIM_STEP.RAPID)
SimulMoveAxis( 'C1', HomeC, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'B1', HomeB, MCH_SIM_STEP.COLLROT)
end
SimulMoveAxis( 'Z1', MaxZ1, RapSimStep)
end
SimulMoveAxis( 'Z1', MaxZ1, MCH_SIM_STEP.RAPID)
-- altrimenti sega a catena
else
SimulMoveAxes( 'Z1', HomeZ, RapSimStep, 'B1', HomeB, CollSimRotStep)
SimulMoveAxes( 'Z1', HomeZ, RapSimStep, 'B1', HomeB, MCH_SIM_STEP.COLLROT)
if CurrX > DeltaTabY then
SimulMoveAxis( 'X1', DeltaTabY, RapSimStep)
SimulMoveAxis( 'X1', DeltaTabY, MCH_SIM_STEP.RAPID)
end
SimulMoveAxis( 'C1', HomeC, CollSimRotStep)
SimulMoveAxis( 'Z1', MaxZ1, RapSimStep)
SimulMoveAxis( 'C1', HomeC, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'Z1', MaxZ1, MCH_SIM_STEP.RAPID)
end
-- se lavorazione in doppio
if EMT.DOU_TYPE == 2 then
SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID)
SimulMoveAxis( 'Z2', ParkZ2, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B2', ParkB2, MCH_SIM_STEP.COLLROT, 'C2', ParkC2, MCH_SIM_STEP.COLLROT)
EMT.DOU_TO_ZMAX = nil
elseif EMT.DOU_TYPE == 3 then
SimulMoveAxis( 'Z2', ParkZ2, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B2', ParkB2, MCH_SIM_STEP.COLLROT, 'C2', ParkC2, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID)
EMT.DOU_TO_ZMAX = nil
end
-- altrimenti testa sotto
else
SimulMoveAxes( 'Z2', MinZ2, RapSimStep)
SimulMoveAxes( 'B2', ParkB2, CollSimRotStep, 'C2', ParkC2, CollSimRotStep)
SimulMoveAxis( 'X2', ParkX2, RapSimStep)
SimulMoveAxis( 'Z2', ParkZ2, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B2', ParkB2, MCH_SIM_STEP.COLLROT, 'C2', ParkC2, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID)
end
EMT.ZMAX = true
end
@@ -1067,7 +1244,7 @@ function ExecUnloading()
-- li sposto per lasciare spazio al nuovo pezzo
local nId = EgtGetFirstInGroup( nVmGrpId)
while nId do
EgtMove( nId, Vector3d( 0, -( EMT.SB + 50.0), 0), GDB_RT.GLOB)
EgtMove( nId, Vector3d( 0, -( EMT.HB + 50.0), 0), GDB_RT.GLOB)
nId = EgtGetNext( nId)
end
-- creo un nuovo layer e vi inserisco il nuovo pezzo
@@ -1126,8 +1303,6 @@ end
---------------------------------------------------------------------
function ExecParkRoller( PosY1, PosY2, PosV1, PosV2, bSpliCut, bAgg)
-- step di simulazione
local RapSimStep = 4 * EMT.SIMSTEP
-- Posizioni
local PosT = EgtGetAxisPos( 'T')
PosY1 = PosY1 or EgtGetAxisPos( 'Y1')
@@ -1146,11 +1321,11 @@ function ExecParkRoller( PosY1, PosY2, PosV1, PosV2, bSpliCut, bAgg)
-- aggancio i pezzi rimanenti all'asse Y1
LinkRemainingPartsToY1()
-- eseguo i movimenti
if not SimulMoveAxes( 'T', PosT + min( DiffY2, 0.0), RapSimStep,
'V1', ParkV1, RapSimStep,
'V2', ParkV2, RapSimStep,
'Y1', PosY1 + max( DiffY1, 0.0), RapSimStep,
'Y2', PosY2 + min( DiffY2, 0.0), RapSimStep) then
if not SimulMoveAxes( 'T', PosT + min( DiffY2, 0.0), MCH_SIM_STEP.RAPID,
'V1', ParkV1, MCH_SIM_STEP.RAPID,
'V2', ParkV2, MCH_SIM_STEP.RAPID,
'Y1', PosY1 + max( DiffY1, 0.0), MCH_SIM_STEP.RAPID,
'Y2', PosY2 + min( DiffY2, 0.0), MCH_SIM_STEP.RAPID) then
EMT.ERR = 2
EmtSetLastError( 1202, 'Error on MoveAxes in ParkRoller (12A)')
end
@@ -1159,28 +1334,28 @@ function ExecParkRoller( PosY1, PosY2, PosV1, PosV2, bSpliCut, bAgg)
EMT.ERR = 2
EmtSetLastError( 1201, 'Error Collision in ParkRoller')
elseif DiffY1 > 0.1 then
if not SimulMoveAxes( 'T', PosT + DiffY1, RapSimStep,
'V1', ParkV1, RapSimStep,
'V2', ParkV2, RapSimStep,
'Y1', PosY1 + DiffY1, RapSimStep,
'Y2', PosY2 + DiffY1, RapSimStep) then
if not SimulMoveAxes( 'T', PosT + DiffY1, MCH_SIM_STEP.RAPID,
'V1', ParkV1, MCH_SIM_STEP.RAPID,
'V2', ParkV2, MCH_SIM_STEP.RAPID,
'Y1', PosY1 + DiffY1, MCH_SIM_STEP.RAPID,
'Y2', PosY2 + DiffY1, MCH_SIM_STEP.RAPID) then
EMT.ERR = 2
EmtSetLastError( 1202, 'Error on MoveAxes in ParkRoller (12B)')
end
return 12
elseif DiffY2 < -0.1 then
if not SimulMoveAxes( 'T', PosT + DiffY2, RapSimStep,
'V1', ParkV1, RapSimStep,
'V2', ParkV2, RapSimStep,
'Y1', PosY1 + DiffY2, RapSimStep,
'Y2', PosY2 + DiffY2, RapSimStep) then
if not SimulMoveAxes( 'T', PosT + DiffY2, MCH_SIM_STEP.RAPID,
'V1', ParkV1, MCH_SIM_STEP.RAPID,
'V2', ParkV2, MCH_SIM_STEP.RAPID,
'Y1', PosY1 + DiffY2, MCH_SIM_STEP.RAPID,
'Y2', PosY2 + DiffY2, MCH_SIM_STEP.RAPID) then
EMT.ERR = 2
EmtSetLastError( 1203, 'Error on MoveAxes in ParkRoller (12C)')
end
return 21
else
if not SimulMoveAxes( 'V1', ParkV1, RapSimStep,
'V2', ParkV2, RapSimStep) then
if not SimulMoveAxes( 'V1', ParkV1, MCH_SIM_STEP.RAPID,
'V2', ParkV2, MCH_SIM_STEP.RAPID) then
EMT.ERR = 2
EmtSetLastError( 1204, 'Error on MoveAxes in MoveStart')
end
@@ -1190,27 +1365,27 @@ function ExecParkRoller( PosY1, PosY2, PosV1, PosV2, bSpliCut, bAgg)
local MoveV1 = ParkV1 - PosV1
local DiffY1 = MyParkY1 - PosY1
local MoveY1 = EgtIf( DiffY1 > 0.1, MoveV1, 0)
local TryMoveY1 = ParkV1 - PosT - EgtIf( bSpliCut or EMT.FALL, EMT.LT, 0)
local TryMoveY1 = ParkV1 - PosT - EgtIf( bSpliCut or EMT.FALL, EMT.LP, 0)
if ( PosT > ParkV2 - ExtraParkV and PosT < ParkV1 and PosY1 + TryMoveY1 < MaxY1) then MoveY1 = max( MoveY1, TryMoveY1) end
-- se appena eseguito taglio di separazione
if bSpliCut then
-- aggancio i pezzi rimanenti all'asse Y1
LinkRemainingPartsToY1()
-- eseguo movimenti
if not SimulMoveAxes( 'T', PosT, RapSimStep,
'V1', ParkV1, RapSimStep,
'V2', ParkV2, RapSimStep,
'Y1', PosY1 + MoveY1, RapSimStep,
'Y2', MyParkY2, RapSimStep) then
if not SimulMoveAxes( 'T', PosT, MCH_SIM_STEP.RAPID,
'V1', ParkV1, MCH_SIM_STEP.RAPID,
'V2', ParkV2, MCH_SIM_STEP.RAPID,
'Y1', PosY1 + MoveY1, MCH_SIM_STEP.RAPID,
'Y2', MyParkY2, MCH_SIM_STEP.RAPID) then
EMT.ERR = 2
EmtSetLastError( 1205, 'Error on MoveAxes in ParkRoller (1)')
end
else
if not SimulMoveAxes( 'T', PosT + MoveY1, RapSimStep,
'V1', ParkV1, RapSimStep,
'V2', ParkV2, RapSimStep,
'Y1', PosY1 + MoveY1, RapSimStep,
'Y2', MyParkY2, RapSimStep) then
if not SimulMoveAxes( 'T', PosT + MoveY1, MCH_SIM_STEP.RAPID,
'V1', ParkV1, MCH_SIM_STEP.RAPID,
'V2', ParkV2, MCH_SIM_STEP.RAPID,
'Y1', PosY1 + MoveY1, MCH_SIM_STEP.RAPID,
'Y2', MyParkY2, MCH_SIM_STEP.RAPID) then
EMT.ERR = 2
EmtSetLastError( 1205, 'Error on MoveAxes in ParkRoller (1)')
end
@@ -1220,22 +1395,22 @@ function ExecParkRoller( PosY1, PosY2, PosV1, PosV2, bSpliCut, bAgg)
local MoveV2 = ParkV2 - PosV2
local DiffY2 = MyParkY2 - PosY2
local MoveY2 = EgtIf( DiffY2 < -0.1, MoveV2, 0)
local TryMoveY2 = ParkV2 - PosT - EMT.LT
if ( PosT + EMT.LT < ParkV1 + ExtraParkV and PosT + EMT.LT > ParkV2 and PosY2 + TryMoveY2 > MinY2) then MoveY2 = min( MoveY2, TryMoveY2) end
if not SimulMoveAxes( 'T', PosT + MoveY2, RapSimStep,
'V1', ParkV1, RapSimStep,
'V2', ParkV2, RapSimStep,
'Y1', EgtIf( PosY1 > MyParkY1, PosY1, MyParkY1), RapSimStep,
'Y2', PosY2 + MoveY2, RapSimStep) then
local TryMoveY2 = ParkV2 - PosT - EMT.LP
if ( PosT + EMT.LP < ParkV1 + ExtraParkV and PosT + EMT.LP > ParkV2 and PosY2 + TryMoveY2 > MinY2) then MoveY2 = min( MoveY2, TryMoveY2) end
if not SimulMoveAxes( 'T', PosT + MoveY2, MCH_SIM_STEP.RAPID,
'V1', ParkV1, MCH_SIM_STEP.RAPID,
'V2', ParkV2, MCH_SIM_STEP.RAPID,
'Y1', EgtIf( PosY1 > MyParkY1, PosY1, MyParkY1), MCH_SIM_STEP.RAPID,
'Y2', PosY2 + MoveY2, MCH_SIM_STEP.RAPID) then
EMT.ERR = 2
EmtSetLastError( 1206, 'Error on MoveAxes in ParkRoller (2)')
end
return 22
else
if not SimulMoveAxes( 'V1', ParkV1, RapSimStep,
'V2', ParkV2, RapSimStep,
'Y1', MyParkY1, RapSimStep,
'Y2', MyParkY2, RapSimStep) then
if not SimulMoveAxes( 'V1', ParkV1, MCH_SIM_STEP.RAPID,
'V2', ParkV2, MCH_SIM_STEP.RAPID,
'Y1', MyParkY1, MCH_SIM_STEP.RAPID,
'Y2', MyParkY2, MCH_SIM_STEP.RAPID) then
EMT.ERR = 2
EmtSetLastError( 1207, 'Error on MoveAxes in ParkRoller (0)')
end
@@ -1245,8 +1420,8 @@ end
---------------------------------------------------------------------
function ExecCloseRoller( nInd)
EgtSetAxisPos( EgtIf( nInd == 1, 'PV1', 'PV2'), EMT.SB)
EgtSetAxisPos( EgtIf( nInd == 1, 'QV1', 'QV2'), EMT.HB)
EgtSetAxisPos( EgtIf( nInd == 1, 'PV1', 'PV2'), EMT.HB)
EgtSetAxisPos( EgtIf( nInd == 1, 'QV1', 'QV2'), EMT.SB)
end
---------------------------------------------------------------------
@@ -1263,15 +1438,19 @@ function RemoveScraps()
local nPart = EgtVolZmapPartCount( vMillId)
if nPart > 1 then
-- ricerca del pezzo con massimo volume
local dTCenX = -EgtGetAxisPos( 'T') - EMT.LP / 2
local nPartMax = 0
local dVolMax = 0
for i = 1, nPart do
local dVol = EgtVolZmapPartVolume( vMillId, i - 1)
if dVol > dVolMax then
local b3VmPart = EgtVolZmapGetPartBBoxGlob( vMillId, i - 1, GDB_BB.STANDARD)
if b3VmPart and b3VmPart:getMax():getX() > dTCenX and b3VmPart:getMin():getX() < dTCenX then
dVolMax = dVol
nPartMax = i
end
end
end
-- eliminazione di tutti i pezzi piccoli
for i = nPart, 1, -1 do
if i ~= nPartMax then
@@ -1452,14 +1631,14 @@ end
---------------------------------------------------------------------
function GetV1ToClose()
--EgtOutLog( string.format( 'L1m=%.3f L1M=%.3f V2NP=%.3f LB=%.3f', EMT.MAXMIN[1], EMT.MAXMAX[1], EMT.V2NEXTPOS, EMT.LB))
--EgtOutLog( string.format( 'LB=%.3f LT=%.3f', EMT.LB, EMT.LT or 0))
--EgtOutLog( string.format( 'LB=%.3f LT=%.3f', EMT.LB, EMT.LP or 0))
return ( EMT.MAXMAX[1] <= EMT.V1NEXTPOS + RollCageMin and EMT.MAXMIN[1] + EMT.LB >= EMT.V1NEXTPOS + RollCageMax)
end
---------------------------------------------------------------------
function GetV2ToClose()
--EgtOutLog( string.format( 'L1m=%.3f L1M=%.3f V2NP=%.3f LB=%.3f', EMT.MAXMIN[1], EMT.MAXMAX[1], EMT.V2NEXTPOS, EMT.LB))
--EgtOutLog( string.format( 'LB=%.3f LT=%.3f', EMT.LB, EMT.LT or 0))
--EgtOutLog( string.format( 'LB=%.3f LT=%.3f', EMT.LB, EMT.LP or 0))
return ( EMT.MAXMAX[1] <= EMT.V2NEXTPOS - RollCageMax and EMT.MAXMIN[1] + EMT.LB >= EMT.V2NEXTPOS - RollCageMin)
end
@@ -1483,13 +1662,23 @@ function LoadFirstTool( nHSet, sTcPosDef)
sTool = vTools[1]
sTcPos = sTcPosDef
if nHSet == 1 then
if SecondSaw and sTcPos == 'T11' then
sHead = 'H16'
else
sHead = EgtIf( sTcPos == 'T1', 'H12', 'H11')
end
else
sHead = 'H21'
end
end
end
if sTool then
-- imposto correttamente i dati di testa
local OrigEMC = EMC
EMC = { HEAD = sHead, TOOL = sTool, TCPOS = sTcPos, TOTLEN = 0}
OnSetHead()
EMC = OrigEMC
-- carico l'utensile
EgtLoadTool( sHead, 1, sTool)
ShowToolInTcPos( sTcPos, false)
end
@@ -1901,7 +2090,7 @@ end
---------------------------------------------------------------------
function GetHeadSet( sHead)
if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' then
if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' or sHead == 'H16' then
return 1
elseif sHead == 'H21' then
return 2
@@ -2027,7 +2216,7 @@ end
---------------------------------------------------------------------
function RollerParkingNeeded( sHead, dAng1p, dAng2p, dAng1, dAng2)
if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' then
if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' or sHead == 'H16' then
return ( abs( dAng1 - dAng1p) > 1 or ( abs( dAng2 - dAng2p) > 1 and abs( dAng1 % 180.0) > 1))
elseif sHead == 'H21' then
return ( abs( dAng1 - dAng1p) > 1 or ( abs( dAng2 - dAng2p) > 1 and abs( dAng1 % 180.0) > 1))
+1 -1
View File
@@ -1,4 +1,4 @@
-- Special Operations macchina Essetre-PF1250 by EgalTech s.r.l. 2023/06/28
-- Special Operations macchina Essetre-PF1250 by EgalTech s.r.l. 2023/11/21
-- Intestazioni
require( 'EmtGenerator')
EgtEnableDebug( false)
Binary file not shown.